activeadmin 覆盖索引操作
我的问题与 ActiveAdmin 中的自定义有关。 首先,我不知道如何覆盖索引操作。根据文档,一切看起来都很简单,但很少有事情能按预期工作。最终我想出了这两种选择。第一个是 博客文章,它提供了以下解决方案(似乎有效) )。
scope_to do
Class.new do
def self.projects
Project.where(:id => 1)
end
end
end
虽然这个是问题#511 的解决方案,但不起作用。谁能告诉为什么?
scope_to :current_project
controller do
private
def current_project
Project.where(:id => 1)
end
end
你的经验是什么?如何实现索引动作定制?
我是一位经验丰富的 Web 开发人员,但总体来说我对 Ruby 世界还是个新手。 您认为在生产项目中使用 ActiveAdmin 是个好主意吗?当谈到管理界面时,您会选择什么? 我读过有关 Rails Admin 的内容,但看起来定制起来并不容易。
我目前最担心的是,主动管理不容易自定义以实现与默认提供的 UI 或行为非常不同的 UI 或行为。
你怎么认为?
my problem is related to customization in ActiveAdmin.
First of all I can't get how to override index action. Everything looks simple according to the documentation but very few things work as expected. Eventually I came up with these two alternatives. First one is a blogpost which presents the following solution (which appear to work).
scope_to do
Class.new do
def self.projects
Project.where(:id => 1)
end
end
end
While this one, which is the solution for issue#511 does not work. Can anyone tell why??
scope_to :current_project
controller do
private
def current_project
Project.where(:id => 1)
end
end
What's your experience? How do you achieve index action customization?
I'm an experienced web developer but I'm new to Ruby world in general.
Do you think it's a good idea to use ActiveAdmin for a production project? What's you pick when it comes to Admin interface?
I've read about Rails Admin but looks like it's not easy to customize.
My biggest concern at the moment is about active admin not easy to customize to achieve UI or behavior which are very different from the ones that it offers by default.
What do you think?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
如果您想自定义控制器,请参阅 https://github.com/josevalim/inherited_resources。例如:
If you want to customize controller see https://github.com/josevalim/inherited_resources. For example: