Hi all, I have a partial and call a method list_users in that partial (in partial: users = list_users(showtree.id)) I get undefined method `list_users'' for #<#<Class:0x5530124>: 0x55300fc> error I have defined a function in a controller admin_controller.rb and the partial is called in the corresponding admin view. I find it strange that the method is not known? Someone knows what I''m doing wrong? Thanks in advance Stijn --~--~---------~--~----~------------~-------~--~----~ 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 2/3/07, Tarscher <tarscher-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> > Hi all, > > I have a partial and call a method list_users in that partial (in > partial: users = list_users(showtree.id)) > > I get undefined method `list_users'' for #<#<Class:0x5530124>: > 0x55300fc> error > > I have defined a function in a controller admin_controller.rb and the > partial is called in the corresponding admin view. I find it strange > that the method is not known? > > Someone knows what I''m doing wrong? > > Thanks in advance > StijnIf that list_users() function is defined in the controller you must make it available to the view by explicitly using helper_method(): # admin_controller.rb def list_users ... end helper_method :list_users Hope this helps. -- Zack Chandler http://depixelate.com --~--~---------~--~----~------------~-------~--~----~ 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, that solved it On 3 feb, 19:02, "Zack Chandler" <zackchand...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> On 2/3/07,Tarscher<tarsc...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > > > > > > Hi all, > > > I have a partial and call a method list_users in that partial (in > > partial: users = list_users(showtree.id)) > > > I get undefined method `list_users'' for #<#<Class:0x5530124>: > > 0x55300fc> error > > > I have defined a function in a controller admin_controller.rb and the > > partial is called in the corresponding admin view. I find it strange > > that the method is not known? > > > Someone knows what I''m doing wrong? > > > Thanks in advance > > Stijn > > If that list_users() function is defined in the controller you must > make it available to the view by explicitly using helper_method(): > > # admin_controller.rb > def list_users > ... > end > helper_method :list_users > > Hope this helps. > > -- > Zack Chandlerhttp://depixelate.com--~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---