According to rolify gem documentation. This gem adds the rolify method to your User class. You can also specify optional callbacks on the User class for when roles are added or removed:
class User < ActiveRecord::Base
rolify :before_add => :before_add_method
def before_add_method(role)
# do something before it gets added
end
end
The rolify method accepts the following callback options:
before_add
after_add
before_remove
after_remove
Mongoid callbacks are also supported and works the same way.
when i add multiple callbacks to rolify it only works for last one my code
class User < ActiveRecord::Base
rolify :before_add => :before_add_method
rolify :before_remove => :before_remove_method
private
def before_add_method(role)
#to do
end
def before_remove_method(role)
#to do
end
end
only before_remove_method method called. Any suggestion how we can add multiple callbacks to rolify gem?