varvet / godmin

Admin framework for Rails 5+
http://godmin-sandbox.herokuapp.com
MIT License
486 stars 51 forks source link

Bypass before_action methods #236

Closed benjamin-thomas closed 1 year ago

benjamin-thomas commented 7 years ago

Could be related to issue #220.


Hi,

I've used your gem for quite a while now which I still find great.

Sometimes however, I may need to to completely override the controller's new and create methods, but not edit, destroy, etc.

I find it pretty difficult and clumsy to workaround the before_action methods that get in the way.

Due to inheritance and rails internals, I'm not sure much can be done about this.

In other words, at some point, I may want to override completely the default godmin behavior and provide my own, while still retaining the UI. At that point, I may need to override some partials, set some instance variables, but that's easier to workaround. I may even want to do without a service object.

Any thoughts?

One easy fix would be to simply not use the controller's before_action class method, but call the appropriate setters/getters directly from the index/show/edit/etc methods themselves.

Would you find any drawback with this approach?