Sha256: a97f5dcdc3124c64da10ee10fb380453bad4091d994817e4fe50075aa416f211

Contents?: true

Size: 434 Bytes

Versions: 2

Compression:

Stored size: 434 Bytes

Contents

class <%= role_class %>
  include DataMapper::Resource
  
  def self.named role_names 
    where(:name.in => role_names.flatten)
  end

  property :id, Serial
  property :name, String

  validates_uniqueness_of :name

  has n, :<%= user_role_class.to_s.pluralize.underscore %>
  has n, :<%= user_class.to_s.pluralize.underscore %>, :through => :<%= user_role_class.to_s.pluralize.underscore %>

  extend RoleClass::ClassMethods
end  

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
roles_data_mapper-0.3.1 lib/generators/data_mapper/roles/templates/many_roles/role.rb
roles_data_mapper-0.3.0 lib/generators/data_mapper/roles/templates/many_roles/role.rb