Ruby on rails 传递控制器逻辑,如@答案=答案。全部;,到活动管理部分

Ruby on rails 传递控制器逻辑,如@答案=答案。全部;,到活动管理部分,ruby-on-rails,activeadmin,partials,Ruby On Rails,Activeadmin,Partials,我在dashboards.rb文件中为活动管理员创建了此部分。我需要将变量传递给partial,这样它就可以在/Admin的dashboard部分呈现数据。我需要在控制器中创建方程,或者在局部可以得到的地方,并将它们传递给局部。在active admin中我在哪里可以执行此操作 # == Render Partial Section # The block is rendered within the context of the view, so you can # easily re

我在dashboards.rb文件中为活动管理员创建了此部分。我需要将变量传递给partial,这样它就可以在/Admin的dashboard部分呈现数据。我需要在控制器中创建方程,或者在局部可以得到的地方,并将它们传递给局部。在active admin中我在哪里可以执行此操作

# == Render Partial Section
  # The block is rendered within the context of the view, so you can
  # easily render a partial rather than build content in ruby.
  #
    section "Month One Statistics" do
      div do
        render 'recent_graphs' # => this will render /app/views/admin/dashboard/_recent_posts.html.erb
       end
     end

试试维基,它有很好的解释,还有其他好处:


感谢您的反馈。更新链接和答案。