Hey all,
I have this in my plugins directory:
1: <% if current_user && current_user.admin? %>
2: <div class="blogAdminLinks">
3: <ul class="blogList">
4: <li class="blogListFirst"><%= link_to 'New Blog Post',
new_blog_post_path %></li>
As you can see,it references current_user
So I define current_user in User model as a global variable:
cattr_accessor :current_user
I application controller, I define who current user is:
def current_user
@current_user = User.find(1)
return @current_user if defined?(@current_user)
end
It does appear that the method overrides the one in model, assuming the
one in model is a getter/setter.
Nevertheless, when I make a reference to it in one of my views, I get
undefined error method. Any idea?
Thanks for response.
--
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 [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en.