i just want an application through which i can dynamically assign roles to users through check boxes. Any answer will be appreciated.
Thanks
i just want an application through which i can dynamically assign roles to users through check boxes. Any answer will be appreciated.
Thanks
There is this gem "cancan" by Ryan Bates.
https://github.com/ryanb/cancan
It integrates nicely with Devise for authentication as well.
Read this 2 - part tutorial.
class Ability
include CanCan::Ability
def initialize(user)
if user.admin?
can :manage, :all
else
user.permissions.each do |permission|
can permission.action_name.to_sym, permission.object_type.constantize # Getting the class name
end
end
end
end
This would now dynamically create permissions for the user. Does this help?