mirror of
https://github.com/rails/rails.git
synced 2022-11-09 12:12:34 -05:00
Added documentation for usage of associative resources with form_for
This commit is contained in:
parent
d167cfd62b
commit
a6913bf7eb
1 changed files with 11 additions and 1 deletions
|
@ -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:
|
||||
|
|
Loading…
Reference in a new issue