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'?
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'?
You should use a -
in front of your if statement, probably:
- if current_user.has_role? :admin
= link_to current_user.name, '#'
When you use an =
there, it's going to display the result of that expression, which is not what you want.