Is it possible to add nested form to #show page?
Now i have my admin/posts.rb:
ActiveAdmin.register Post do
show do |post|
h2 post.title
post.comments.each do |comment|
row :comment do comment.text end
end
end
end
It lists all the comments for post. Now i need a form to add new comments. I'm trying to do like this:
ActiveAdmin.register Post do
show do |post|
h2 post.title
post.comments.each do |comment|
row :comment do comment.text end
end
form do |f|
f.has_many :comments do |c|
c.input :text
end
end
end
end
and get an error:
undefined method `has_many' for <form></form> :Arbre::HTML::Form
Models for Post and Comments look like:
class Post < ActiveRecord::Base
has_many :comments
accepts_nested_attributes_for :comments
end
class Comment < ActiveRecord::Base
belongs_to :post
end
How do i add that form to my show page? Thanks