Hi,
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:
class Symbol
def to_tabnav
file_name = ''tabnav/'' + self.id2name +
''_tabnav''
load( File.join( File::expand_path(RAILS_ROOT), ''app'',
''models'',
file_name + ''.rb'' ) )
eval(file_name.camelcase).instance
end
end
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?
Cheers,
Tomasz Bak
--
Posted via http://www.ruby-forum.com/.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Ruby on Rails: Talk" group.
To post to this group, send email to
rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---