Sha256: ae0f4c1572f2b69f7f0dd491f3fb8accfd80ed30adf949ec6c64f84dc7dd1a82
Contents?: true
Size: 689 Bytes
Versions: 3
Compression:
Stored size: 689 Bytes
Contents
module Citygate # @author Zamith class Permission < ActiveRecord::Base attr_accessible :action, :subject_class, :subject_id, :role_id, :conditions belongs_to :role # Load all the permissions for all the roles # DB intensive, should run only once! def self.load_all permissions = {} # Get guest permissions permissions[:guest] = Citygate::Permission.find_all_by_role_id(nil) # Get everyother role permissions roles = Citygate::Role.select [:id, :name] roles.each do |role| permissions[role.name.underscore.to_sym] = Citygate::Permission.find_all_by_role_id(role.id) end return permissions end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
citygate-0.0.9 | app/models/citygate/permission.rb |
citygate-0.0.8 | app/models/citygate/permission.rb |
citygate-0.0.7 | app/models/citygate/permission.rb |