Gavin Morrice wrote:
You shouldn't be making database calls from the view.
If you're making calls for the application layout then I'd add these
to the application controller and call them with a before_filter
(anyone know a better way ?)
If the objects you are calling are the same from one page to the next
you could try using an "or equals"
so instead of always calling
@current_user = User.find session[:user_id]
you could write @current_user ||= User.find session[:user_id]
This should mean that the database call is only made if @current_user
does that help?
On Apr 20, 1:33?pm, Preethi Sivakumar <rails-mailing-l...@andreas-
Thanks for your response.
But, Am not making any db calls from view. I've helpers for everything
which renders some tabs for user depending on his view. The queries for
fetching the permissions that the person has and everything is fectched
from db everytime the page is loaded even though that part of the layout
is static once it is fectched for the first time. It gets refreshed
everytime. That is the problem. i want only part of my page to be
refreshed and other parts to remain static once loaded. How to achieve