http://pastie.org/404716 Only produces "hello", not "world". Which is as designed, but how do I make it do what I want - namely, set a variable in a class method, and have that variable available in a view helper? --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
Frederick Cheung
2009-Mar-02 15:47 UTC
Re: scope problem: controller class methods and helpers.
On Mar 2, 3:25 pm, jbc <jcatt...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> http://pastie.org/404716 > > Only produces "hello", not "world". > > Which is as designed, but how do I make it do what I want - namely, > set a variable in a class method, and have that variable available in > a view helper?Only instance variables of the controller are copied across to the view (your bar is an instance variable of the class). easiest way would probably be to have an accessor method for it and then you can do controller.bar in your view. Fred --~--~---------~--~----~------------~-------~--~----~ 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@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---