mirror of
https://github.com/github/rails.git
synced 2026-04-26 03:00:59 -04:00
The example in the API docs incorrectly indicated that form_for would use the same default route for both new and previously persisted records. The default path given in the example would have generated a routing error for new records. form_for actually uses polymorphic_path to determine which route to use based on the state of the record. The example has been updated to reflect the method's actual behavior.
This commit is contained in:
committed by
Xavier Noria
parent
7ff491c567
commit
8ac4e4dbce
@@ -202,13 +202,13 @@ module ActionView
|
||||
#
|
||||
# is equivalent to something like:
|
||||
#
|
||||
# <%= form_for @post, :as => :post, :url => post_path(@post), :html => { :class => "new_post", :id => "new_post" } do |f| %>
|
||||
# <%= form_for @post, :as => :post, :url => posts_path, :html => { :class => "new_post", :id => "new_post" } do |f| %>
|
||||
# ...
|
||||
# <% end %>
|
||||
#
|
||||
# You can also overwrite the individual conventions, like this:
|
||||
#
|
||||
# <%= form_for(@post, :url => super_post_path(@post)) do |f| %>
|
||||
# <%= form_for(@post, :url => super_posts_path) do |f| %>
|
||||
# ...
|
||||
# <% end %>
|
||||
#
|
||||
|
||||
Reference in New Issue
Block a user