Am trying to hide this publish ‘tick-box’ from non-admin users. I used the CanCan plug-in and set up the correct permissions but am struggling with the code syntax. I have used <%= if can? :publish, article %> in the views/articles/_form.html.erb partial but it doesn’t work?
<div class="field">
<%= f.label :tag_names, "Tags" %> <br />
<%= f.text_field :tag_names %>
</div>
<div class="field">
<%= check_box("article", "published" ) %>
**<%= if can? :publish, @article %>**
<%= "Publish article" %>
</div>
<div class="actions">
<%= f.submit %>
</div>

You should be using
<%, not<%=. Also, theifstatement is in the wrong place, and there’s no closingendstatement. Here’s correct code: