Sha256: 73d6988122b26440a47348fd0b4f4cd1e09813d1fd544d16fce1dd4dd5abab42
Contents?: true
Size: 804 Bytes
Versions: 2
Compression:
Stored size: 804 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) time = Conversions.time_to_utc_string(time.utc) if time.kind_of? Time virtual_table = select(%[ #{quoted_table_name}.*, #{connection.quote(time)}::timestamp AS "as_of_time"] ).to_sql as_of = all.from("(#{virtual_table}) #{quoted_table_name}") as_of.instance_variable_set(:@temporal, time) return as_of end include TimeMachine::HistoryMethods::Timeline end 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
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
chrono_model-0.8.2 | lib/chrono_model/time_gate.rb |
chrono_model-0.8.0 | lib/chrono_model/time_gate.rb |