Skip to content

Instantly share code, notes, and snippets.

@mt9304

mt9304/role.rb Secret

Created October 8, 2018 18:54
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mt9304/ef8fd420d43ecdd442e9c418c6667243 to your computer and use it in GitHub Desktop.
Save mt9304/ef8fd420d43ecdd442e9c418c6667243 to your computer and use it in GitHub Desktop.
class Role < ApplicationRecord
has_and_belongs_to_many :users, :join_table => :users_roles
belongs_to :resource,
:polymorphic => true,
optional: true
validates :resource_type,
:inclusion => { :in => Rolify.resource_types },
:allow_nil => true
scopify
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment