How to mixin and call link_to from controller in Rails?
This doesn't really answer your question but there is an easier way
For Rails 5, use the helpers
proxy
helpers.link_to '...', '...'
For Rails 3 and 4, since you are using the helper from a controller you can use the view_context
# in the controller code
view_context.link_to '...', '...'
# instead of using your mixin code
link_to '...', '...'
For Rails 2, since you are using the helper from a controller you can actually access the @template member variable of the controller, the @template is the view and already has the UrlHelper mixed in
# in the controller code
@template.link_to '...', '...'
# instead of using your mixin code
link_to '...', '...'
if you need to use the urlhelper from code other than the controller, your solution is probably the way to go
Compatible with Rails 3,4 and 5:
view_context.link_to