I'm checking if a user is an admin, and then I will show a delete button
if he is. For whatever reason, it's automatically setting the boolean to
true. It says is_admin: false in the console when I pull up the user's
record.
Check status of user
def is_admin?
self.username
end
view method
<% if @user.is_admin? %>
<%= link to 'Delete', remove_bla_bla_path(user), method: :destroy %>
<% end %>
Have any ideas to why the method is still showing the button?
--
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 unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscribe@googlegroups.com.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/e271d6cdea52f5ca85bb048cb9f21afd%40ruby-forum.com.
For more options, visit https://groups.google.com/d/optout.
No comments:
Post a Comment