【问题标题】:Adding active_admin_comments method in View file在视图文件中添加 active_admin_comments 方法
【发布时间】:2016-01-14 11:00:41
【问题描述】:

是否可以在视图文件中添加 active_admin_cmets 方法? 另外,我也尝试过这种方式,但它并没有保存 cmets。

     <%= 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 %>

那你建议我做什么?

【问题讨论】:

    标签: ruby-on-rails model-view-controller view comments activeadmin


    【解决方案1】:

    MVC 模式被开发用于分离信息和数据管理的表示。

    你为什么不把你的方法移到控制器或模型上?

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2010-11-18
      • 2014-02-04
      • 1970-01-01
      相关资源
      最近更新 更多