Module: ActiveRecord::Bitemporal::Relation::Finder
- Defined in:
- lib/activerecord-bitemporal/bitemporal.rb
Instance Method Summary collapse
Instance Method Details
#find(*ids) ⇒ Object
128 129 130 131 132 133 134 135 136 |
# File 'lib/activerecord-bitemporal/bitemporal.rb', line 128 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
142 143 144 145 146 147 |
# File 'lib/activerecord-bitemporal/bitemporal.rb', line 142 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
138 139 140 |
# File 'lib/activerecord-bitemporal/bitemporal.rb', line 138 def find_at_time!(datetime, *ids) valid_at(datetime).find(*ids) end |