This does not actually answer your question, but there is an easier way
For Rails 5 use proxy helpers
helpers.link_to '...', '...'
For Rails 3 and 4 , since you are using the helper from the controller, you can use view_context
# in the controller code view_context.link_to '...', '...'
For Rails 2 , since you use the helper from the controller, you can access the member variable @template of the controller, @template is a view, and UrlHelper is already mixed in it.
# in the controller code @template.link_to '...', '...' # instead of using your mixin code link_to '...', '...'
if you need to use urlhelper from code other than the controller, your solution will probably help you
house9 01 Oct '10 at 23:27 2010-10-01 23:27
source share