decent_exposure icon indicating copy to clipboard operation
decent_exposure copied to clipboard

Raise ArgumentError when expose overwrite helpers

Open vinc opened this issue 7 years ago • 2 comments

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 avatar Feb 21 '18 14:02 vinc

@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 avatar Feb 21 '18 16:02 mattpolito

@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.

vinc avatar Feb 21 '18 17:02 vinc