class RoleStatus include Mongoid::Document field :key, type: String field :title, type: String, localize: true field :disable, type: Boolean, default: false scope :can_display, ->{ where(disable: false) } has_and_belongs_to_many :member_profiles belongs_to :role def self.get_role_data(role_key) @role = Role.find_by(key: role_key) return @role.id end end