Sha256: a4f19847bbe98deb18552ae70b6a1dc2100b37dce1decbda079e20a638f9aa07
Contents?: true
Size: 483 Bytes
Versions: 821
Compression:
Stored size: 483 Bytes
Contents
class Caboose::Permission < ActiveRecord::Base self.table_name = "permissions" #has_and_belongs_to_many :roles has_many :role_permissions has_many :roles, :through => :role_permissions attr_accessible :action, :resource def self.allow(role_id, resource, action) role = Role.find(role_id) perm = Permission.where(:resource => resource, :action => action).first return if role.nil? || perm.nil? role.permissions.push(perm) role.save end end
Version data entries
821 entries across 821 versions & 1 rubygems