将控制器逻辑(如“@answers = Answer.all”)传递给Active Admin partial

时间:2011-11-28 19:32:35

标签: ruby-on-rails activeadmin partials

我在主动管理的dashboards.rb文件中创建了此部分。我需要将变量传递给partial,以便它可以在/ 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

1 个答案:

答案 0 :(得分:1)

尝试维基,它有一个很好的解释,以及其他好东西

https://github.com/gregbell/active_admin/wiki/