aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack/lib/action_view/helpers/form_helper.rb
diff options
context:
space:
mode:
authorRizwan Reza <rizwanreza@gmail.com>2010-07-01 23:07:24 +0430
committerRizwan Reza <rizwanreza@gmail.com>2010-07-01 23:07:24 +0430
commita6913bf7eb614d9e5008cf4230104babfec7c6c4 (patch)
tree72f4e8d4e57ad83065c2b5b8441d2ed4eadc5125 /actionpack/lib/action_view/helpers/form_helper.rb
parentd167cfd62b31333e11fcb9de4ea33dfabde7fa82 (diff)
downloadrails-a6913bf7eb614d9e5008cf4230104babfec7c6c4.tar.gz
rails-a6913bf7eb614d9e5008cf4230104babfec7c6c4.tar.bz2
rails-a6913bf7eb614d9e5008cf4230104babfec7c6c4.zip
Added documentation for usage of associative resources with form_for
Diffstat (limited to 'actionpack/lib/action_view/helpers/form_helper.rb')
-rw-r--r--actionpack/lib/action_view/helpers/form_helper.rb12
1 files changed, 11 insertions, 1 deletions
diff --git a/actionpack/lib/action_view/helpers/form_helper.rb b/actionpack/lib/action_view/helpers/form_helper.rb
index d1b10a9281..6302491c2a 100644
--- a/actionpack/lib/action_view/helpers/form_helper.rb
+++ b/actionpack/lib/action_view/helpers/form_helper.rb
@@ -213,12 +213,22 @@ module ActionView
# ...
# <% end %>
#
- # And for namespaced routes, like +admin_post_url+:
+ # For namespaced routes, like +admin_post_url+:
#
# <%= form_for([:admin, @post]) do |f| %>
# ...
# <% end %>
#
+ # If your resource has associations defined, for example, you want to add comments
+ # to the post given that the routes are set correctly:
+ #
+ # <%= form_for([@document, @comment]) do |f| %>
+ # ...
+ # <% end %>
+ #
+ # Where +@document = Document.find(params[:id])+ and
+ # +@comment = Comment.new+.
+ #
# === Unobtrusive JavaScript
#
# Specifying: