lib/timescaledb/acts_as_hypertable.rb in timescaledb-0.2.7 vs lib/timescaledb/acts_as_hypertable.rb in timescaledb-0.2.8
- old
+ new
@@ -40,10 +40,13 @@
# @example Enabling the macro on your model with options
# class Event < ActiveRecord::Base
# acts_as_hypertable time_column: :timestamp
# end
#
+ # @param [Hash] options The options to initialize your macro with.
+ # @option options [Boolean] :skip_association_scopes to avoid `.hypertable`, `.chunks` and other scopes related to metadata.
+ # @option options [Boolean] :skip_default_scopes to avoid the generation of default time related scopes like `last_hour`, `last_week`, `yesterday` and so on...
def acts_as_hypertable(options = {})
return if acts_as_hypertable?
include Timescaledb::ActsAsHypertable::Core
@@ -51,11 +54,11 @@
self.hypertable_options = DEFAULT_OPTIONS.dup
hypertable_options.merge!(options)
normalize_hypertable_options
- define_association_scopes
- define_default_scopes
+ define_association_scopes unless options[:skip_association_scopes]
+ define_default_scopes unless options[:skip_default_scopes]
end
end
end
ActiveRecord::Base.extend Timescaledb::ActsAsHypertable