It depends on how complex your permissions are, you could define a method in the user model called (for example) is_admin? That returns a Boolean, and then surround the links in a
<% if current_user.is_admin? %>
(Link here)
<% end %>
If your needs are a bit more complex then I would look at the 'rolify' gem, which can give you some fine grained role control, even down to an individual record
So you can have a 'global' admin, or a table (model) admin, or a (user) record admin.
I have used this in the past to make me a global admin, but when a user record is created, I make the user an admin (well manager anyway) of that record so they can update it
That may be too complex for your needs but the functionality is there
--
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/d557a9dc-e8a8-41c7-a4b8-8c65fa74272f%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
1 comment:
Indeed a nice content, thanks for sharing with us.
https://www.plaxonic.com/virtual-assistant.php
Post a Comment