Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

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.
  • Loading branch information...
commit 8ac4e4dbcefaa5fb4a6c9c573ea1fd12d23858a7 1 parent 7ff491c
@mjroghelia mjroghelia authored fxn committed
Showing with 2 additions and 2 deletions.
  1. +2 −2 actionpack/lib/action_view/helpers/form_helper.rb
View
4 actionpack/lib/action_view/helpers/form_helper.rb
@@ -202,13 +202,13 @@ def convert_to_model(object)
#
# 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 %>
#
Please sign in to comment.
Something went wrong with that request. Please try again.