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? --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
On Nov 30, 8:04 pm, danb <d...-ZFKsivP1bGvOQU1ULcgDhA@public.gmane.org> 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? --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---