Sha256: cbba3b020759fa2070fd242ededc4f6944d9bfc1881b70d807af5fbb3ac4af7e

Contents?: true

Size: 592 Bytes

Versions: 5

Compression:

Stored size: 592 Bytes

Contents

# encoding: utf-8
module Freeberry
  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

5 entries across 5 versions & 1 rubygems

Version Path
freeberry-0.3.0 lib/freeberry/models/role.rb
freeberry-0.2.9 lib/freeberry/models/role.rb
freeberry-0.2.7 lib/freeberry/models/role.rb
freeberry-0.2.6 lib/freeberry/models/role.rb
freeberry-0.2.5 lib/freeberry/models/role.rb