Open bf4 opened 8 years ago
@mshibuya any thoughts?
This topic appears to be too broad...
Controller actions are instance_eval
ed in RailsAdmin::MainController, so self
in custom action proc references the controller instance. Is this the answer you're looking for?
These features are to be implemented through specifically-designed RailsAdmin-ish DSL, not monkey-patching. If you have new DSL idea, please feel free to open PR and we'll discuss it there.
@mshibuya
Thanks for writing back!
I am specifically not referring to custom actions, but to a scenario where I want to, e.g. add eager loading to a model in an action. I shouldn't need to wait for RailsAdmin to promote that to a DSL, right? Right now, I think the ways to do it are both hacks:
This lack of access to what I'm calling 'controller primitives' was also a problem for me in a previous project that used ActiveAdmin. The DSL is great, but exposing a 'controller do' or 'super do' would make a lot of my struggles with customizing our admin easier. I know Rails pretty well, and maybe that's part of my problem :)
Does that help? Or any of the referenced issues?
I've already made a solution for eager-loading, creating DSL is just so simple. https://github.com/sferik/rails_admin/commit/b92a4d1a30b706d08df2aee4d0a59dad698a0552
@mshibuya but, unless I'm misunderstanding, the only way for me to make the change in that ref is by a PR to the repo, whereas what I'm interested in is not needing to do that. I think that with the changeset in https://github.com/sferik/rails_admin/pull/2649 I could have used a hack to access the controller by taking advantage of 'render'.
Or, more directly, how could I have gotten the behavior of b92a4d1 without a PR to rails_admin?
If this exists, I can't find it, but is there a place where, either in an action or in a configuration, that I can access the controller class or instance? It'd make working with RailsAdmin a lot easier if I had access to what I'm calling the primitives-- the things every Rails dev knows, even if they can't figure something out using the RailsAdmin DSL.
When I make a custom action I controller the proc that is evaluated in the control. Would be nice if the built-in controller proc's called out to some method hook I could use.
I know there's a MainController and I know there are actions, but I don't know what to modify them per generated controller or controller action.
This would be particularly useful for fixing N+1 queries.
There's a lot of people monkeypatching RailsAdmin to be able to do these kinds of things :(
I'm happy to help, but thus far my efforts have failed. Any guidance is appreciated.
Related:
Possibly Related: