Hello list! I have a navigation bar where I want''t to display the recently added members with a partial. When I jump let''s say to an action in the LinksController and render the partial it will fail because the partial does not know about the Member model. Where to put def get_members @members = Member.find(:all) end so the every partial can access it? Thanx -- Jochen --~--~---------~--~----~------------~-------~--~----~ 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 27 Apr 2008, at 20:36, Jochen kaechelin wrote:> > Hello list! > > I have a navigation bar where I want''t to display the recently added > members with a partial. > > When I jump let''s say to an action in the LinksController and render > the partial it will > fail because the partial does not know about the Member model. > > Where to put > > def get_members > @members = Member.find(:all) > end > > so the every partial can access it?make it a before_filter 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 -~----------~----~----~----~------~----~------~--~---
Am 27.04.2008 um 21:43 schrieb Frederick Cheung:> > > On 27 Apr 2008, at 20:36, Jochen kaechelin wrote: > >> >> Hello list! >> >> I have a navigation bar where I want''t to display the recently added >> members with a partial. >> >> When I jump let''s say to an action in the LinksController and render >> the partial it will >> fail because the partial does not know about the Member model. >> >> Where to put >> >> def get_members >> @members = Member.find(:all) >> end >> >> so the every partial can access it? > > make it a before_filterThats''s the way I did it .... Let''s say I have 10 controllers .. then I have to put it in there 10 times? Is this correct? I thought there might be a specail place to put. Thanx> > > 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 -~----------~----~----~----~------~----~------~--~---
On 27 Apr 2008, at 20:47, Jochen Kaechelin wrote:> > > Am 27.04.2008 um 21:43 schrieb Frederick Cheung: > >> >> >> On 27 Apr 2008, at 20:36, Jochen kaechelin wrote: >> >>> >>> Hello list! >>> >>> I have a navigation bar where I want''t to display the recently added >>> members with a partial. >>> >>> When I jump let''s say to an action in the LinksController and render >>> the partial it will >>> fail because the partial does not know about the Member model. >>> >>> Where to put >>> >>> def get_members >>> @members = Member.find(:all) >>> end >>> >>> so the every partial can access it? >> >> make it a before_filter > > Thats''s the way I did it .... > Let''s say I have 10 controllers .. then I have to put it in there 10 > times? > Is this correct? >No - make it a before_filter in application.rb Fred> I thought there might be a specail place to put. > > Thanx > > >> >> >> 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 -~----------~----~----~----~------~----~------~--~---
Am 27.04.2008 um 21:53 schrieb Frederick Cheung:> > > On 27 Apr 2008, at 20:47, Jochen Kaechelin wrote: > >> >> >> Am 27.04.2008 um 21:43 schrieb Frederick Cheung: >> >>> >>> >>> On 27 Apr 2008, at 20:36, Jochen kaechelin wrote: >>> >>>> >>>> Hello list! >>>> >>>> I have a navigation bar where I want''t to display the recently >>>> added >>>> members with a partial. >>>> >>>> When I jump let''s say to an action in the LinksController and >>>> render >>>> the partial it will >>>> fail because the partial does not know about the Member model. >>>> >>>> Where to put >>>> >>>> def get_members >>>> @members = Member.find(:all) >>>> end >>>> >>>> so the every partial can access it? >>> >>> make it a before_filter >> >> Thats''s the way I did it .... >> Let''s say I have 10 controllers .. then I have to put it in there 10 >> times? >> Is this correct? >> > No - make it a before_filter in application.rbOk, thanx. That''s what I was looking for. Great!!! --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---