Sha256: ae78b6e61effab95496055db4930ed77d4ee0d7f8457764aa19db1027872954e

Contents?: true

Size: 590 Bytes

Versions: 6

Compression:

Stored size: 590 Bytes

Contents

# encoding: utf-8
module Sunrise
  module Models
    module Role
      def self.included(base)
        base.send :include, InstanceMethods
        base.send :extend,  ClassMethods
      end
      
      module ClassMethods
        def self.extended(base)
          base.class_eval do
            belongs_to :user
        
            enumerated_attribute :role_type, :id_attribute => :role_type
            attr_accessible :role_type
          end
        end
      end
      
      module InstanceMethods
        def to_sym
          role_type.code
        end
      end
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
sunrise-core-0.1.5 lib/sunrise/models/role.rb
sunrise-core-0.1.4 lib/sunrise/models/role.rb
sunrise-core-0.1.3 lib/sunrise/models/role.rb
sunrise-core-0.1.2 lib/sunrise/models/role.rb
sunrise-core-0.1.1 lib/sunrise/models/role.rb
sunrise-core-0.1.0 lib/sunrise/models/role.rb