Where to put my Member.find(:all)

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

On 27 Apr 2008, at 20:36, Jochen kaechelin wrote:

Where to put

def get_members
@members = Member.find(:all)
end

so the every partial can access it?

make it a before_filter

Fred

On 27 Apr 2008, at 20:47, Jochen K. wrote:

@members = Member.find(:all)

No - make it a before_filter in application.rb

Fred

Am 27.04.2008 um 21:43 schrieb Frederick C.:

When I jump let’s say to an action in the LinksController and render

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?

I thought there might be a specail place to put.

Thanx

Am 27.04.2008 um 21:53 schrieb Frederick C.:

On 27 Apr 2008, at 20:36, Jochen kaechelin wrote:

the partial it will
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

Ok, thanx. That’s what I was looking for. Great!!!