This project is archived and is in readonly mode.
form_for doesn't work with an uncountable route
Reported by Ravil Bayramgalin | July 23rd, 2008 @ 01:25 PM | in 2.x
def new
@news = News.new
end
<% form_for(@news) do |f| %>
...
<% end %>
This code throws error:
ActionView::TemplateError (news_url failed to generate from {:action=>"show", :controller=>"news"} - you may have ambiguous routes, or you may need to supply additional parameters for this route. content_url has the following required parameters: ["news", :id] - are they all satisfied?)
As workaround i use more verbose version of form_for:
<% form_for(:news, news_index_url) do |f| %>
...
<% end %>
But it would be better to use same syntax in case of uncountable resources.
Comments and changes to this ticket
-
Pratik July 23rd, 2008 @ 01:41 PM
- State changed from new to invalid
Create your profile
Help contribute to this project by taking a few moments to create your personal profile. Create your profile »
<h2 style="font-size: 14px">Tickets have moved to Github</h2>
The new ticket tracker is available at <a href="https://github.com/rails/rails/issues">https://github.com/rails/rails/issues</a>