Module: ActiveRecord::Bitemporal::Relation::Finder
- Defined in:
- lib/activerecord-bitemporal/bitemporal.rb
Instance Method Summary collapse
Instance Method Details
#find(*ids) ⇒ Object
116 117 118 119 120 121 122 123 124 |
# File 'lib/activerecord-bitemporal/bitemporal.rb', line 116 def find(*ids) return super if block_given? all.spawn.yield_self { |obj| def obj.primary_key "bitemporal_id" end obj.method(:find).super_method.call(*ids) } end |
#find_at_time(datetime, *ids) ⇒ Object
130 131 132 133 134 135 |
# File 'lib/activerecord-bitemporal/bitemporal.rb', line 130 def find_at_time(datetime, *ids) find_at_time!(datetime, *ids) rescue ActiveRecord::RecordNotFound expects_array = ids.first.kind_of?(Array) || ids.size > 1 expects_array ? [] : nil end |
#find_at_time!(datetime, *ids) ⇒ Object
126 127 128 |
# File 'lib/activerecord-bitemporal/bitemporal.rb', line 126 def find_at_time!(datetime, *ids) valid_at(datetime).find(*ids) end |