Verbose Logging

software development with some really amazing hair

T + S G I F R

role_on: Really Simple Roles (For Rails)

· · Posted in Programming
Tagged with

I looked at a few role systems for Rails, but never found what I wanted. They were all object based systems, never just "allow a user with this role to do this action". Either that or I never found the systems that did that, or totally missed the docs on how to configure those systems to do what I wanted. Well, actually acl9 seemed to do that, but whatever.

So I made role_on

The instructions are on Github, so I won't repeat them here, but it's pretty straight forward. You control your roles yourself (which are just habtm between User, and identified by a string), and this just allows you to say something like this in your controller:

It also add a method on the User class to check roles, so you can do something like this in views:

if current_user.has_role?(:amin) # do stuff…


Sharing is Caring