I still can''t decide. One recommendation is to call a things
controller as a component in your layout. I checked the Typo source
and they call an application helper from the layout which collects the
data from the things model and renders it with a partial.
I think building the code in the layout as you describe is probably
the least good, but I wish I had a good rule of thumb for when to use
each construct.
On 5/24/05, Tyler Kiley
<tyler.kiley-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
wrote:> If you use data from a database for global navigation in a layout
> file, what''s the "proper" way to retrieve that data? It
seems rather
> inefficient to put
>
> @things = Thing.find(:all)
>
> in every controller that uses that layout; is it a Bad Thing(tm) to just
put
>
> <% Thing.find(:all).each do %>
>
> in a layout?
>
> Tyler
> _______________________________________________
> Rails mailing list
> Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org
> http://lists.rubyonrails.org/mailman/listinfo/rails
>