Sha256: 2542c2f33a17e3d31f550380d1e9c6ac73a99d84d300a8b6113dbf93e22aec04
Contents?: true
Size: 448 Bytes
Versions: 28
Compression:
Stored size: 448 Bytes
Contents
class User < ApplicationRecord after_initialize :set_default_role, if: :new_record? # Include default devise modules. Others available are: # :confirmable, :lockable, :timeoutable, :trackable and :omniauthable devise :database_authenticatable, :registerable, :recoverable, :rememberable, :validatable has_many :posts enum role: { user: 0, moderator: 1, admin: 9 } private def set_default_role self.role ||= :user end end
Version data entries
28 entries across 28 versions & 1 rubygems