I have problem with config.cache_classes = true.
After turning it on, the current_user in tabnav file
definition is not updated.
class Tabnav::MainTabnav < Tabnav::Base
current_user = User.find(Thread.current[‘user’])
if current_user.has_role? Role::ADMIN add_tab do named '' iconed '/images/layout/icons/admin_icon.png' links_to :controller => '/users' highlights_on :controller => 'users' end end
When I try:
file_name = ‘tabnav/’ + self.id2name + ‘_tabnav’
load( File.join( File::expand_path(RAILS_ROOT), ‘app’, ‘models’,
file_name + ‘.rb’ ) )
I get user updated, but the code of class is executed twice:
one with load and then with eval(file_name.camelcase).
Because I need to return eval(file_name.camelcase).instance,
But I also need the file to be always up tu date.
Any idea how I might solve it?