Module: Timescaledb::Rails::Model::FinderMethods
- Included in:
- ClassMethods
- Defined in:
- lib/timescaledb/rails/model/finder_methods.rb
Overview
:nodoc:
Instance Method Summary collapse
-
#find(*args) ⇒ Object
Adds a warning message to avoid calling find without filtering by time.
-
#find_after(id, from) ⇒ Object
Finds records by primary key and chunk time occurring after given time.
-
#find_at_time(id, time) ⇒ Object
Finds records by primary key and chunk time.
-
#find_between(id, from, to) ⇒ Object
Finds records by primary key and chunk time occurring between given time range.
Instance Method Details
#find(*args) ⇒ Object
Adds a warning message to avoid calling find without filtering by time.
11 12 13 14 15 |
# File 'lib/timescaledb/rails/model/finder_methods.rb', line 11 def find(*args) warn "WARNING: Calling `.find` without filtering by `#{hypertable_time_column_name}` could cause performance issues, use built-in find_(at_time|between|after) methods for more performant results." # rubocop:disable Layout/LineLength super end |
#find_after(id, from) ⇒ Object
Finds records by primary key and chunk time occurring after given time.
38 39 40 |
# File 'lib/timescaledb/rails/model/finder_methods.rb', line 38 def find_after(id, from) after(from).find(id) end |
#find_at_time(id, time) ⇒ Object
Finds records by primary key and chunk time.
21 22 23 |
# File 'lib/timescaledb/rails/model/finder_methods.rb', line 21 def find_at_time(id, time) at_time(time).find(id) end |
#find_between(id, from, to) ⇒ Object
Finds records by primary key and chunk time occurring between given time range.
30 31 32 |
# File 'lib/timescaledb/rails/model/finder_methods.rb', line 30 def find_between(id, from, to) between(from, to).find(id) end |