Sha256: b636d1c5a9bae99f46dd9396e89a015ec1652b20cf2d5d075cd438e3d7177bbf

Contents?: true

Size: 507 Bytes

Versions: 16

Compression:

Stored size: 507 Bytes

Contents

module ChronoModel

  # Provides the TimeMachine API to non-temporal models that associate
  # temporal ones.
  #
  module TimeGate
    extend ActiveSupport::Concern

    module ClassMethods
      def as_of(time)
        all.as_of_time!(time)
      end

      include TimeMachine::HistoryMethods::Timeline
    end

    include Patches::AsOfTimeHolder

    def as_of(time)
      self.class.as_of(time).where(:id => self.id).first!
    end

    def timeline
      self.class.timeline(self)
    end
  end

end

Version data entries

16 entries across 16 versions & 1 rubygems

Version Path
chrono_model-1.0.1 lib/chrono_model/time_gate.rb
chrono_model-0.13.2 lib/chrono_model/time_gate.rb
chrono_model-1.0.0 lib/chrono_model/time_gate.rb
chrono_model-0.13.1 lib/chrono_model/time_gate.rb
chrono_model-0.13.0 lib/chrono_model/time_gate.rb
chrono_model-0.12.3 lib/chrono_model/time_gate.rb
chrono_model-0.12.2 lib/chrono_model/time_gate.rb
chrono_model-0.12.1 lib/chrono_model/time_gate.rb
chrono_model-0.12.0 lib/chrono_model/time_gate.rb
chrono_model-0.11.1 lib/chrono_model/time_gate.rb
chrono_model-0.11.0 lib/chrono_model/time_gate.rb
chrono_model-0.10.1 lib/chrono_model/time_gate.rb
chrono_model-0.10.0 lib/chrono_model/time_gate.rb
chrono_model-0.9.2 lib/chrono_model/time_gate.rb
chrono_model-0.9.1 lib/chrono_model/time_gate.rb
chrono_model-0.9.0 lib/chrono_model/time_gate.rb