传递控制器逻辑,例如“ @answers = anders.all”,转到主动管理部分
-
22-10-2019 - |
题
我在dashboards.rb文件中为活动管理员创建了此部分。我需要将变量传递到部分,以便可以在 /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
解决方案
尝试Wiki,它具有很好的解释,以及其他 好东西 这里:
不隶属于 StackOverflow