-
Notifications
You must be signed in to change notification settings - Fork 17
Roles Write API
kristianmandrup edited this page May 9, 2011
·
5 revisions
@guest_user.role = :admin
@guest_user.roles = :admin, :guest
@admin_user.remove_role :admin
@admin_user.remove_roles :admin, :guest
@admin_user.add_role :editor
@admin_user.add_roles :editor, :guest
@guest_user.exchange_role :guest, :with => :admin
@guest_user.exchange_roles :guest, :editor :with => :admin
The following methods can be called on a given User class where Roles::ActiveRecord is included.
Admin.valid_roles_are :guest, :admin
Defines which roles are valid for the given User class.
AdminUser.default_role = :super_admin @admin_user = AdminUser.new.role.should == :super_admin
Set the default role for the class.
For more methods see the specs