Calling View helper methods from Controller / Model in Rails

Recently I was researching a way to use link_to inside my Rails 3 controller, and learned about the method view_context.

So if you ever want to access view helper methods from controller / models in rails 3 you have to use view_context method.

Example

view_context.link_to 'Link', link_path(@link)}.

PS:

Just a note that you should avoid calling these functions within the controllers to follow mvc pattern conventions.