将控制器逻辑(例如“@answers = Answer.all”)传递给 Active Admin 部分
我在 Active Admin 的仪表板.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
I created this partial in the dashboards.rb file for Active Admin. I need to pass variables to the partial so it can render that data out on the dashboard section of /Admin. I need to create the equations in a controller, or somewhere where the partial can get at it, and pass them to the partial. Where can I do that in 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
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
尝试一下 wiki,它有很好的解释,以及其他好东西:
https://github.com/gregbell/active_admin/wiki/
Try the wiki, it has a good explanation, as well as other goodies here:
https://github.com/gregbell/active_admin/wiki/