hashrocket / decent_exposure

A helper for creating declarative interfaces in controllers
MIT License
1.81k stars 107 forks source link

Merges with options earlier in sequence and handles #164 #175

Closed hazah closed 1 year ago

hazah commented 6 years ago

Can this be merged into the main project?

mattpolito commented 6 years ago

@hazah Thanks for the PR.

We've honestly never found a reason to use DecentExposure in the way that #164 describes which is why I'm hesitant to make this change. Could you add another example of what this is solving and a test case to show that it's actually doing what you expect?

hazah commented 6 years ago

The number one thing this would resolve is consistency. It is currently possible to use the from option with the decorate option (https://github.com/hazah/decent_exposure/blob/master/spec/decent_exposure/controller_spec.rb#L375). As far as I can tell, the with option is there to have the ability to group together various configurations, and so it should be seamless, as if it was never even used as an option, when actually used.

I will have to conjure up another example, but authorisation is the one that comes up consistently in every single project. At the moment though, I cannot see a case where it makes sense to have a named configuration that cannot be used simply due to the fact that another option happened to be active. I can understand if the with option has, within it, an incompatible option instead. That would make sense to blow out of the water.

I am basically arguing that once options have been pre-processed, there should be no such thing as a with option.