在View文件中添加active_admin_comments方法
Adding active_admin_comments method in View file
是否可以在视图文件中添加 active_admin_comments 方法?
另外,我也试过这种方法,但它没有保存评论。
<%= f.inputs "" do %>
<% f.has_many :comments do |c| %>
<% c.input :_destroy, :as => :boolean, :label => "Remove comment"
unless c.object.nil? or c.object.id.nil? %>
<% c.input :author_id, :as => :hidden, :input_html => { :value => current_admin_user.id } %>
<% c.input :author_type, :as => :hidden, :input_html => { :value => current_admin_user.class.name } %>
<% c.input :body, :label => false, :input_html => { :class => 'autogrow', :rows => 10, :cols => 20 }, :validate => { :presence => true } %>
<% end %>
<% end %>
那你推荐我做什么?
MVC 模式的开发是为了将信息表示和数据管理分开。
为什么不将方法移至控制器或模型?
是否可以在视图文件中添加 active_admin_comments 方法? 另外,我也试过这种方法,但它没有保存评论。
<%= f.inputs "" do %>
<% f.has_many :comments do |c| %>
<% c.input :_destroy, :as => :boolean, :label => "Remove comment"
unless c.object.nil? or c.object.id.nil? %>
<% c.input :author_id, :as => :hidden, :input_html => { :value => current_admin_user.id } %>
<% c.input :author_type, :as => :hidden, :input_html => { :value => current_admin_user.class.name } %>
<% c.input :body, :label => false, :input_html => { :class => 'autogrow', :rows => 10, :cols => 20 }, :validate => { :presence => true } %>
<% end %>
<% end %>
那你推荐我做什么?
MVC 模式的开发是为了将信息表示和数据管理分开。
为什么不将方法移至控制器或模型?