Sha256: c8903d9d46fbfa2bdd3fde0a0b102ba4a10fa2e65ac40830d9f2e26d516803fe

Contents?: true

Size: 601 Bytes

Versions: 62

Compression:

Stored size: 601 Bytes

Contents

# == Schema Information
#
# Table name: roles
#
#  id         :integer(4)      not null, primary key
#  rolename   :string(255)
#  created_at :datetime
#  updated_at :datetime
#

class Role < ActiveRecord::Base
  unloadable
  
  has_many :permissions, :dependent => :destroy
  has_many :users, :through => :permissions
  
  validates_presence_of :rolename
  validates_uniqueness_of :rolename

  scope :by_alpha, order('roles.rolename ASC')

  # roles can be defined as symbols.  We want to store them as strings in the database
  def rolename= val
    write_attribute(:rolename, val.to_s)
  end

end

Version data entries

62 entries across 62 versions & 1 rubygems

Version Path
muck-users-3.2.25 app/models/role.rb
muck-users-3.2.24 app/models/role.rb
muck-users-3.2.23 app/models/role.rb
muck-users-3.2.22 app/models/role.rb
muck-users-3.2.21 app/models/role.rb
muck-users-3.2.20 app/models/role.rb
muck-users-3.2.19 app/models/role.rb
muck-users-3.2.18 app/models/role.rb
muck-users-3.2.17 app/models/role.rb
muck-users-3.2.16 app/models/role.rb
muck-users-3.2.15 app/models/role.rb
muck-users-3.2.14 app/models/role.rb
muck-users-3.2.13 app/models/role.rb
muck-users-3.2.12 app/models/role.rb
muck-users-3.2.11 app/models/role.rb
muck-users-3.2.10 app/models/role.rb
muck-users-3.2.9 app/models/role.rb
muck-users-3.2.8 app/models/role.rb
muck-users-3.2.7 app/models/role.rb
muck-users-3.2.6 app/models/role.rb