Is it possible to add nested form to the #show page?
Now I have my admin / post .rb:
post ActiveAdmin.register | Posted in | H2 post.title post.comments.each | Comment | Row: comment comments. Text End End Ends This lists all comments for the post. Now I need a form to add new comments. I am trying to do this:
Post ActiveAdmin.register | Posted in | H2 post.title post.comments.each | Comment | Row: comment comments. Let the end of the text end. F | F.has_many: Comments | C | Get one more error:
Unchanged method & lt; Form & gt; & Lt; / Form & gt; For 'has_many': Arbre :: HTML :: form
Looks like a model for posts and comments:
class post ActiveRecord :: Base has has_many: Comments accepts __nested_attributes_for: Comments and class comment & lt; ActiveRecord :: Base is_to: post end How do I add that form to my show page? Thanks
I use the following method when I add this kind of information to a show page
Post ActiveAdmin.register Show: Title = & gt; : Email | Posted in | Attribute_tribble row: id row: first_name line: last_name end div: class = & gt; Do "panels" H3 "comments" if post comments and postcats.text; gt; 0 div: class = & gt; Divide "Panel_contents": class = & gt; "Attribute_tables", do table, "comment text" and end tabs post com. Comment | Tr do td do comment.text end end end end end end h3 "no comment available" end and end
Comments
Post a Comment