forked from activeadmin/activeadmin
-
Notifications
You must be signed in to change notification settings - Fork 0
Embed namespaced nested form
juvenn edited this page Aug 26, 2012
·
2 revisions
For a namespaced nested resource:
namespace :admin do
resource :posts do
resource :comments
end
end
To embed comment
form in show post page:
ActiveAdmin.register Post do
# ...
show do
# One column for post, and the other for comments
columns do
column do
# show post here
end
column to
# first show comment tree ...
# then the comment form
active_admin_form_for [:admin, post, post.comments.new] do |f|
f.inputs # ...
end
end
end
end
end
To summarize:
- The ability to layout with
columns
andcolumn
- Use
active_admin_form_for
, instead ofsemantic_form_for
to embed the form (the latter seems not capturing more than the last input) - Nested resource can be namespaced with an array like
[:admin, post, post.comments.new]