I have a Rails 4 project using Ruby 2.0. I've defined some refinements. Putting
<% using MyRefinements %>
at the top of the view files causes the error "undefined method 'using'".
When I add:
using MyRefinements
At the top of my controller (above the class declaration), I can successfully use the refinement in the controller, but I get an 'undefined method' error if I try to use it in the view.
Thanks!
Unfortunately, this does not seem possible. For posterity, I'm documenting the things I tried that didn't work:
In the view:
<% using MyRefinements %>
In the controller (each tried separately):
using MyRefinements
helper :MyRefinements
helper_method :MyRefinements
helper { using MyRefinements }
In the helper:
using MyRefinements
Note that refinements become available in the controller and in the helper, but never in the view.
Too bad.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With