是否可以将嵌套窗体添加到#显示页面?#显示页面上的ActiveAdmin嵌套窗体
现在我有我的管理/ 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
它列出了所有职位的评论。 现在我需要一个表单来添加新评论。 我试着这样做:
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
,并得到一个错误:
undefined method `has_many' for <form></form> :Arbre::HTML::Form
模型邮政和评论是这样的:
class Post < ActiveRecord::Base
has_many :comments
accepts_nested_attributes_for :comments
end
class Comment < ActiveRecord::Base
belongs_to :post
end
如何添加这种形式到我的展示页面? 感谢
我们如何为注释添加输入textarea? – WarLord 2015-12-05 10:47:29