Sha256: 8d8190d572a75bc1bbecc377e9752bc2745476e36156413f4a5493ce51a471a7

Contents?: true

Size: 333 Bytes

Versions: 11

Compression:

Stored size: 333 Bytes

Contents

class Role < ActiveRecord::Base
  scope :named, lambda{|role_names| where(:name.in => role_names.flatten)}
  has_many :users, :through => :user_roles
  has_many :user_roles
  validates :name, :uniqueness => true
  
  extend RoleClass::ClassMethods  
end

class UserRole < ActiveRecord::Base
  belongs_to :user
  belongs_to :role
end

Version data entries

11 entries across 11 versions & 1 rubygems

Version Path
roles_active_record-0.4.9 lib/roles_active_record/many_roles.rb
roles_active_record-0.4.8 lib/roles_active_record/many_roles.rb
roles_active_record-0.4.7 lib/roles_active_record/many_roles.rb
roles_active_record-0.4.6.4 lib/roles_active_record/many_roles.rb
roles_active_record-0.4.6.3 lib/roles_active_record/many_roles.rb
roles_active_record-0.4.6.2 lib/roles_active_record/many_roles.rb
roles_active_record-0.4.6.1 lib/roles_active_record/many_roles.rb
roles_active_record-0.4.6 lib/roles_active_record/many_roles.rb
roles_active_record-0.4.5 lib/roles_active_record/many_roles.rb
roles_active_record-0.4.4 lib/roles_active_record/many_roles.rb
roles_active_record-0.4.3 lib/roles_active_record/many_roles.rb