In view I set validation for roles (gems cancan and rolify).
As example in HAML
=if current_user.has_role? :admin
= link_to current_user.name, '#'
Generated HTML
<a href="#">Administrator</a>
"
0
"
Why I see ‘0’?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
You should use a
-in front of your if statement, probably:When you use an
=there, it’s going to display the result of that expression, which is not what you want.