Sha256: 82866c1b5d1aab581107b7c77ebd401fdfb59716e3fa0ade7f06a127c22646b9

Contents?: true

Size: 666 Bytes

Versions: 5

Compression:

Stored size: 666 Bytes

Contents

# coding: utf-8
module ActsAsFootprintable
  class Footprint < ::ActiveRecord::Base
    if ::ActiveRecord::VERSION::MAJOR < 4
      attr_accessible :footprintable_id, :footprintable_type,
                      :footprinter_id,  :footprinter_type,
                      :footprintable, :footprinter
    end

    belongs_to :footprintable, :polymorphic => true
    belongs_to :footprinter, :polymorphic => true

    scope :for_type, lambda{|klass| where(:footprintable_type => klass)}
    scope :by_type,  lambda{|klass| where(:footprinter_type   => klass)}

    validates :footprintable_id, :presence => true
    validates :footprinter_id, :presence => true
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
acts_as_footprintable-0.2.3 lib/acts_as_footprintable/footprint.rb
acts_as_footprintable-0.2.2 lib/acts_as_footprintable/footprint.rb
acts_as_footprintable-0.2.1 lib/acts_as_footprintable/footprint.rb
acts_as_footprintable-0.2.0 lib/acts_as_footprintable/footprint.rb
acts_as_footprintable-0.1.0 lib/acts_as_footprintable/footprint.rb