Recently I was researching a way to use
link_to inside my Rails 3 controller, and learned about the method
So if you ever want to access view helper methods from controller / models in rails 3 you have to use view_context method.
view_context.link_to 'Link', link_path(@link)}.
Just a note that you should avoid calling these functions within the controllers to follow mvc pattern conventions.
Subscribe to Today I learned
Get the latest posts delivered right to your inbox