Topic: Is this an efficient way to use before_filter in application.rb?
I'm trying to find ways to make my application more efficient. Here, I have a before_filter in the application.rb, which sets vital information for the application. However, as I'm looking at the log, it seems that these calls are made everytime I go to a page or do anything. Is there a way to make these more efficient?
# in application.rb
@current_account = Account.find(session[:id]) if @current_account.nil? && session[:id]
session[:app_current_year] = Configuration.find_by_category('current_year').value
@current_year = session[:app_current_year]
@current_version = Configuration.find_by_category('version').value if @current_version.nil?
@app_email = Configuration.find_by_category('app_email_address').value if @app_email.nil?
@msg_fade_time= Configuration.find_by_category('msg_fade_time').value if @msg_fade_time.nil?
The only alternative I could think of would be storing them in sessions, but I really don't know if that's faster or not. Anyone know of a more efficient way to do this? Thanks.