Sha256: 6b250f5f05e1145154cb678fa6bba2138a1d8ad9b218743d0d581322dda6f62a

Contents?: true

Size: 717 Bytes

Versions: 3

Compression:

Stored size: 717 Bytes

Contents

module Heritage
  module ActiveRecord
    module ActsAsPredecessor
      
      def acts_as_predecessor(options = {})
        extend ClassMethods
        include InstanceMethods
        
        options[:exposes] ||= []
        class_attribute :_acts_as_predecessor_settings
        self._acts_as_predecessor_settings = options
        
        belongs_to :heir, :polymorphic => true, :touch => true
      end
      
      module ClassMethods
        
        def get_heritage_exposed_methods
          result = self._acts_as_predecessor_settings[:exposes]
          result.is_a?(Array) ? result : [result]
        end
        
      end
      
      module InstanceMethods
        
      end
      
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
heritage-0.3.0 lib/heritage/active_record/acts_as_predecessor.rb
heritage-0.2.0 lib/heritage/active_record/acts_as_predecessor.rb
heritage-0.1.0 lib/heritage/active_record/acts_as_predecessor.rb