On 31 March 2010 15:21, Tony Tony <li...@ruby-forum.com> wrote:
> [code]
>
> <%= content_tag(:li, link_to ("Products", productss_path)) if
> current_user.class == "Client" %>
>
> [/code]
>
> If I change "Client" in the above code to "User" it still doesn't work.
> Is there some special case or usage required to handle
> current_user.class in an if loop?

".class" doesn't return a string, it returns a class...

<%= content_tag(:li, link_to ("Products", productss_path)) if
current_user.class == Client %>

but you might be better using "is_a?(base_class)" - depends what the
intention of your code is:

<%= content_tag(:li, link_to ("Products", productss_path)) if
current_user.is_a?(Client) %>

-- 
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-t...@googlegroups.com.
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.

Reply via email to