All Forms Not Passing Parameters
All of the forms in my rails application are not submitting parameters even to the production.log:
Started GET "/countries/afghanistan/edit/" for 41.132.43.55 at Tue Sep 27 03:39:06 -0700 2011
Processing by CountriesController#edit as HTML
Parameters: {"id"=>"afghanistan"}
Rendered countries/_form.html.erb (80.2ms)
Rendered application/_nav.html.erb (2.8ms)
Rendered countries/edit.html.erb within layouts/application (85.2ms)
Completed 200 OK in 87ms (Views: 85.6ms | ActiveRecord: 0.5ms)
Started GET "/countries/afghanistan/" for 41.132.43.55 at Tue Sep 27 03:40:20 -0700 2011
Processing by CountriesController#show as HTML
Parameters: {"id"=>"afghanistan"}
Rendered application/_nav.html.erb (3.9ms)
Rendered countries/show.html.erb within layouts/application (16.7ms)
Completed 200 OK in 21ms (Views: 15.3ms | ActiveRecord: 2.3ms)
That's from the edit action and then submitting the form it goes straight to the show action. In my dev inspector it shows that the POST request has been permanently moved (301) to the GET request:
I'm not sure what too look for at this point. Everything works fine in development but not in production. Here's my production.rb
App::Application.configure do
config.cache_classes = true
config.consider_all_requests_local = false
config.action_controller.perform_caching = true
config.action_dispatch.x_sendfile_header = "X-Sendfile"
config.serve_static_assets = false
config.i18n.fallbacks = true
config.active_support.deprecation = :notify
ActionMailer::Base.smtp_settings = {
:address => "smtp.gmail.com",
:port => 587,
:user_name => "***@***.com",
:password => "***",
:authentication => "plain",
:enable_starttls_auto => true
}
config.middleware.use ExceptionNotifier,
:email_prefix => "[Exception] ",
:sender_address => %{"Exception Notifier" <***@***.com>},
:exception_recipients => %w{***@***.com}
end
Any help is greatly appreciated. Thanks!
UPDATE 1 Here's the sessions#new
<%= form_tag sessions_path do %>
<p>
<%= label_tag :login, "Email Address" %><br />
<%= text_field_tag :login, params[:login] %>
</p>
<p>
<%= label_tag :password %><br />
<%= password_field_tag :password %>
</p>
<p><%= submit_tag "Log in" %></p>
<% end %>
And here's another one of the forms:
<%= form_for @satellite do |f| %>
<%= f.error_messages %>
<p>
<%= f.label :name %><br />
<%= f.text_field :name %>
</p>
<p>
<% for country in Country.find(:all) %>
<%= check_box_tag "satellite[country_ids][]", country.id, @satellite.countries.include?(country) %>
<%= label_tag "satellite[country_ids][]", country.name, :for => "satellite[country_ids][]" %><br />
<% end %>
</p>
<p><%= f.submit %></p>
<% end %>
But like I said none of the forms are passing parameters.
Update 2 Here's the routes:
edit_current_user /user/edit(.:format) {:controller=>"users", :action=>"edit"}
signup /signup(.:format) {:controller=>"users", :action=>"new"}
logout /logout(.:format) {:controller=>"sessions", :action=>"destroy"}
login /login(.:format) {:controller=>"sessions", :action=>"new"}
sessions GET /sessions(.:format) {:controller=>"sessions", :action=>"index"}
POST /sessions(.:format) {:controller=>"sessions", :action=>"create"}
new_session GET /sessions/new(.:format) {:controller=>"sessions", :action=>"new"}
edit_session GET /sessions/:id/edit(.:format) {:controller=>"sessions", :action=>"edit"}
session GET /sessions/:id(.:format) {:controller=>"sessions", :action=>"show"}
PUT /sessions/:id(.:format) {:controller=>"sessions", :action=>"update"}
DELETE /sessions/:id(.:format) {:controller=>"sessions", :action=>"destroy"}
users GET /users(.:format) {:controller=>"users", :action=>"index"}
POST /users(.:format) {:controller=>"users", :action=>"create"}
new_user GET /users/new(.:format) {:controller=>"users", :action=>"new"}
edit_user GET /users/:id/edit(.:format) {:controller=>"users", :action=>"edit"}
user GET /users/:id(.:format) {:controller=>"users", :action=>"show"}
PUT /users/:id(.:format) {:controller=>"users", :action=>"update"}
DELETE /users/:id(.:format) {:controller=>"users", :action=>"destroy"}
maps GET /maps(.:format) {:controller=>"maps", :action=>"index"}
POST /maps(.:format) {:controller=>"maps", :action=>"create"}
new_map GET /maps/new(.:format) {:controller=>"maps", :action=>"new"}
edit_map GET /maps/:id/edit(.:format) {:controller=>"maps", :action=>"edit"}
map GET /maps/:id(.:format) {:controller=>"maps", :action=>"show"}
PUT /maps/:id(.:format) {:controller=>"maps", :action=>"update"}
DELETE /maps/:id(.:format) {:controller=>"maps", :action=>"destroy"}
country_channels GET /countries/:country_id/channels(.:format) {:controller=>"channels", :action=>"index"}
country_channel GET /countries/:country_id/channels/:id(.:format) {:controller=>"channels", :action=>"show"}
country_satellites GET /countries/:country_id/satellites(.:format) {:controller=>"satellites", :action=>"index"}
country_satellite GET /countries/:country_id/satellites/:id(.:format) {:controller=>"satellites", :action=>"show"}
country_testimonies GET /countries/:country_id/testimonies(.:format) {:controller=>"testimonies", :action=>"index"}
country_testimony GET /countries/:country_id/testimonies/:id(.:format) {:controller=>"testimonies", :action=>"show"}
country_statistics GET /countries/:country_id/statistics(.:format) {:controller=>"statistics", :action=>"index"}
country_statistic GET /countries/:country_id/statistics/:id(.:format) {:controller=>"statistics", :action=>"show"}
country_videos GET /countries/:country_id/videos(.:format) {:controller=>"videos", :action=>"index"}
country_video GET /countries/:country_id/videos/:id(.:format) {:controller=>"videos", :action=>"show"}
country_challenges GET /countries/:country_id/challenges(.:format) {:controller=>"challenges", :action=>"index"}
country_challenge GET /countries/:country_id/challenges/:id(.:format) {:controller=>"challenges", :action=>"show"}
countries GET /countries(.:format) {:controller=>"countries", :action=>"index"}
POST /countries(.:format) {:controller=>"countries", :action=>"create"}
new_country GET /countries/new(.:format) {:controller=>"countries", :action=>"new"}
edit_country GET /countries/:id/edit(.:format) {:controller=>"countries", :action=>"edit"}
country GET /countries/:id(.:format) {:controller=>"countries", :action=>"show"}
PUT /countries/:id(.:format) {:controller=>"countries", :action=>"update"}
DELETE /countries/:id(.:format) {:controller=>"countries", :action=>"destroy"}
channels GET /channels(.:format) {:controller=>"channels", :action=>"index"}
POST /channels(.:format) {:controller=>"channels", :action=>"create"}
new_channel GET /channels/new(.:format) {:controller=>"channels", :action=>"new"}
edit_channel GET /channels/:id/edit(.:format) {:controller=>"channels", :action=>"edit"}
channel GET /channels/:id(.:format) {:controller=>"channels", :action=>"show"}
PUT /channels/:id(.:format) {:controller=>"channels", :action=>"update"}
DELETE /channels/:id(.:format) {:controller=>"channels", :action=>"destroy"}
satellites GET /satellites(.:format) {:controller=>"satellites", :action=>"index"}
POST /satellites(.:format) {:controller=>"satellites", :action=>"create"}
new_satellite GET /satellites/new(.:format) {:controller=>"satellites", :action=>"new"}
edit_satellite GET /satellites/:id/edit(.:format) {:controller=>"satellites", :action=>"edit"}
satellite GET /satellites/:id(.:format) {:controller=>"satellites", :action=>"show"}
PUT /satellites/:id(.:format) {:controller=>"satellites", :action=>"upda开发者_运维技巧te"}
DELETE /satellites/:id(.:format) {:controller=>"satellites", :action=>"destroy"}
testimonies GET /testimonies(.:format) {:controller=>"testimonies", :action=>"index"}
POST /testimonies(.:format) {:controller=>"testimonies", :action=>"create"}
new_testimony GET /testimonies/new(.:format) {:controller=>"testimonies", :action=>"new"}
edit_testimony GET /testimonies/:id/edit(.:format) {:controller=>"testimonies", :action=>"edit"}
testimony GET /testimonies/:id(.:format) {:controller=>"testimonies", :action=>"show"}
PUT /testimonies/:id(.:format) {:controller=>"testimonies", :action=>"update"}
DELETE /testimonies/:id(.:format) {:controller=>"testimonies", :action=>"destroy"}
statistics GET /statistics(.:format) {:controller=>"statistics", :action=>"index"}
POST /statistics(.:format) {:controller=>"statistics", :action=>"create"}
new_statistic GET /statistics/new(.:format) {:controller=>"statistics", :action=>"new"}
edit_statistic GET /statistics/:id/edit(.:format) {:controller=>"statistics", :action=>"edit"}
statistic GET /statistics/:id(.:format) {:controller=>"statistics", :action=>"show"}
PUT /statistics/:id(.:format) {:controller=>"statistics", :action=>"update"}
DELETE /statistics/:id(.:format) {:controller=>"statistics", :action=>"destroy"}
videos GET /videos(.:format) {:controller=>"videos", :action=>"index"}
POST /videos(.:format) {:controller=>"videos", :action=>"create"}
new_video GET /videos/new(.:format) {:controller=>"videos", :action=>"new"}
edit_video GET /videos/:id/edit(.:format) {:controller=>"videos", :action=>"edit"}
video GET /videos/:id(.:format) {:controller=>"videos", :action=>"show"}
PUT /videos/:id(.:format) {:controller=>"videos", :action=>"update"}
DELETE /videos/:id(.:format) {:controller=>"videos", :action=>"destroy"}
challenges GET /challenges(.:format) {:controller=>"challenges", :action=>"index"}
POST /challenges(.:format) {:controller=>"challenges", :action=>"create"}
new_challenge GET /challenges/new(.:format) {:controller=>"challenges", :action=>"new"}
edit_challenge GET /challenges/:id/edit(.:format) {:controller=>"challenges", :action=>"edit"}
challenge GET /challenges/:id(.:format) {:controller=>"challenges", :action=>"show"}
PUT /challenges/:id(.:format) {:controller=>"challenges", :action=>"update"}
DELETE /challenges/:id(.:format) {:controller=>"challenges", :action=>"destroy"}
all_channels /all/channels(.:format) {:controller=>"channels", :action=>"all"}
all_satellites /all/satellites(.:format) {:controller=>"satellites", :action=>"all"}
all_testimonies /all/testimonies(.:format) {:controller=>"testimonies", :action=>"all"}
all_statistics /all/statistics(.:format) {:controller=>"statistics", :action=>"all"}
all_videos /all/videos(.:format) {:controller=>"videos", :action=>"all"}
all_challenges /all/challenges(.:format) {:controller=>"challenges", :action=>"all"}
root /(.:format) {:controller=>"countries", :action=>"map"}
home /home(.:format) {:controller=>"countries", :action=>"map"}
one thing, i ran into a while ago with non-numerical ids, were default constraints on resources
routes. overriding this constraints solved the issue for, but this should be a problem in development mode as well. anyway, you can try
resources :countries, :constraints => { :id => /.*/ }
plus your nested routes
精彩评论