Module: Timescaledb::ActsAsHypertable
- Defined in:
- lib/timescaledb/acts_as_hypertable.rb,
lib/timescaledb/acts_as_hypertable/core.rb
Overview
Note:
Your model’s table needs to have already been converted to a hypertable
If you want your model to hook into its underlying hypertable as well as have access to TimescaleDB specific data, methods, and more, specify this macro in your model.
via the TimescaleDB ‘create_hypertable` function for this to work.
via a Rails migration utilizing the standard ‘create_table` method.
Defined Under Namespace
Modules: Core
Constant Summary collapse
- DEFAULT_OPTIONS =
{ time_column: :created_at }.freeze
Instance Method Summary collapse
-
#acts_as_hypertable(options = {}) ⇒ Object
Configuration options.
- #acts_as_hypertable? ⇒ Boolean
Instance Method Details
#acts_as_hypertable(options = {}) ⇒ Object
Configuration options
48 49 50 51 52 53 54 55 56 57 58 59 60 61 |
# File 'lib/timescaledb/acts_as_hypertable.rb', line 48 def acts_as_hypertable( = {}) return if acts_as_hypertable? include Timescaledb::ActsAsHypertable::Core class_attribute :hypertable_options, instance_writer: false self. = DEFAULT_OPTIONS.dup .merge!() define_association_scopes unless [:skip_association_scopes] define_default_scopes unless [:skip_default_scopes] end |
#acts_as_hypertable? ⇒ Boolean
28 29 30 |
# File 'lib/timescaledb/acts_as_hypertable.rb', line 28 def acts_as_hypertable? included_modules.include?(Timescaledb::ActsAsHypertable::Core) end |