Views & link_to

I have a few related questions about views. Specifically,
how do you call link_to from a method rather than a view?
Calling from a method in the model,
the result of
ActionView::Helpers::UrlHelper.link_to(…)
is
undefined method `link_to’ for ActionView::Helpers::UrlHelper:Module

More generally, how does Rails process a view? What is self inside an
ERb form?
What is its class? (self.class called inside the view returns “#”)
How does it get instance variables from the controller? How does it
get access to link_to?

On Nov 30, 8:04 pm, danb [email protected] wrote:

how do you call link_to from a method rather than a view?

Okay, I finally learned what a module instance method is.
But link_to calls url_for, which looks for @controller, which
is an attribute of ActionView::Base. So what does the object
need to inherit from, and how do you instantiate it?