Put a before_filter in your ApplicationController.

class ApplicationController
  before_filter :set_my_array

  private

  def set_my_array
    @myarray = MyArray.all
  end
end

Cheers,


Andy

-- 
Andy Jeffries
http://andyjeffries.co.uk/      #rubyonrails #mysql #jquery
Registered address: 64 Sish Lane, Stevenage, Herts, SG1 3LS
Company number: 5452840


On 10 March 2010 08:54, capsized <[email protected]> wrote:

> Hi,
>
> I have an application layout that is used to create the general layout
> for all pages.
> However, I seem to struggle to find out how to declare variables like
> arrays so that they are available everytime that layout or its related
> partials are used.
>
> Putting @myarray = MyArray.all into every action in every controller
> doesn't seem very dry, so I guess I'm just looking for a very simple
> straighforward convention, but can't seem to find it documented
> anywhere or figure it out.
>
> _caps
>
> --
> 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 [email protected].
> To unsubscribe from this group, send email to
> [email protected]<rubyonrails-talk%[email protected]>
> .
> For more options, visit this group at
> http://groups.google.com/group/rubyonrails-talk?hl=en.
>
>

-- 
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 [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.

Reply via email to