Sha256: e970844efab81d67042b8bc4012b7105b9a276d9d441876905a1da2713cd094e

Contents?: true

Size: 728 Bytes

Versions: 2

Compression:

Stored size: 728 Bytes

Contents

# Represents an assignment of a permission to a role.  The permissions for a
# role determine what parts of the system that role has access to.
# 
# == Examples
# 
#   RolePermission.bootstrap(
#     {:role => 'admin', :permission => 'application/'},
#     {:role => 'developer', :permission => 'comments/create'},
#     {:role => 'developer', :permission => 'admin/stats/'}
#   )
# 
# Notice that permissions are in the form of the path defined by the
# controller/action.
class RolePermission < ActiveRecord::Base
  extend EnumerateBy::Bootstrapped
  
  belongs_to :role
  belongs_to :permission
  
  validates_presence_of :role_id, :permission_id
  
  bootstrap(
    {:role => 'admin', :permission => 'application/'}
  )
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
has_roles-0.3.1 app/models/role_permission.rb
has_roles-0.3.0 app/models/role_permission.rb