decent_exposure
decent_exposure copied to clipboard
Raise ArgumentError when expose overwrite helpers
Raise ArgumentError when exposing an attribute that will overwrite a helper defined by ActionView.
This PR will prevent expose :tag from silently overwriting the tag helper defined by ActionView::Helpers::TagHelper .
See https://github.com/hashrocket/decent_exposure/issues/180.
@vinc Great PR, thanks!
I think this method of capture will work great for this problem, could you move this logic into the controller file? It seems like a more appropriate place for it since that is where the helpers would get used.
Thanks again.
@mattpolito Thanks for the review!
In the controller file the expose! method have name as first argument but not the expose method, so I moved the check directly to Exposure#initialize. Does that work? It seems better than where I first put it.