Hi all, I have a shared partial that calls a helper function render_foo. I also have render_foo defined in Control1Helper and Control2Helper (each slightly different) However, rails seems to only use the render_foo version in Controller1Helper even when I am responding from Controller2. Is this a correct behavior? Thanks. --Tri --~--~---------~--~----~------------~-------~--~----~ 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 9 Jan 2008, at 16:17, rubeez wrote:> > Hi all, > > I have a shared partial that calls a helper function render_foo. > > I also have render_foo defined in Control1Helper and Control2Helper > (each slightly different) > > However, rails seems to only use the render_foo version in > Controller1Helper even when I am responding from Controller2.By default on rails 2.0 you''ll get helper :all in your application.rb So all helpers get loaded up into all views in all controllers, if 2 of those modules end up defining a function with the same name then 1 of those will win, and it will be the same thing for all controllers. You can get back the pre rails 2 behaviour by removing the helper :all 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-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Thanks, Fred...that fixes it. On Jan 9, 9:41 am, Frederick Cheung <frederick.che...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> On 9 Jan 2008, at 16:17, rubeez wrote: > > > > > Hi all, > > > I have a shared partial that calls a helper function render_foo. > > > I also have render_foo defined in Control1Helper and Control2Helper > > (each slightly different) > > > However, rails seems to only use the render_foo version in > > Controller1Helper even when I am responding from Controller2. > > By default on rails 2.0 you''ll get helper :all in your application.rb > So all helpers get loaded up into all views in all controllers, if 2 > of those modules end up defining a function with the same name then 1 > of those will win, and it will be the same thing for all controllers. > You can get back the pre rails 2 behaviour by removing the helper :all > > 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 -~----------~----~----~----~------~----~------~--~---