Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class Case < ApplicationRecord
- resourcify
- end
- class User < ApplicationRecord
- rolify strict: true
- # Include default devise modules. Others available are:
- # :confirmable, :lockable, :timeoutable and :omniauthable
- devise :database_authenticatable, :registerable,
- :recoverable, :rememberable, :trackable, :validatable
- belongs_to :role
- after_create :assign_default_role
- def assign_default_role
- self.add_role "newuser" if self.roles.blank?
- end
- end
- Case.first.roles.where(name: "facilitator").first
- Case.first.find_roles(:facilitator)
Add Comment
Please, Sign In to add comment