Re: [Rails] Application Controller instance variable available to all views

2010-10-18 Thread Colin Law
On 18 October 2010 17:24, Leonel *.* wrote: > Currently, I have this on the application controller... >  def company_name >    User.find_by_id(session[:user_id]).account.name >  end > > So then in each controller I have to add this, which is not very DRY. > The @company_id needs to be used in almo

[Rails] Application Controller instance variable available to all views

2010-10-18 Thread Leonel *.*
Currently, I have this on the application controller... def company_name User.find_by_id(session[:user_id]).account.name end So then in each controller I have to add this, which is not very DRY. The @company_id needs to be used in almost every page and it's accessed on the application.html