Module: ActiveRecord::Materialized::ChangeSource
- Defined in:
- lib/activerecord/materialized/change_source.rb
Overview
The change sources a view can declare. :callbacks (the default) installs
the built-in ActiveRecord commit-callback tracker on depends_on models;
:none installs no callbacks and expects changes through the public
ingestion API from an external adapter.
Constant Summary collapse
Class Method Summary collapse
-
.cast(source) ⇒ Object
Validates and normalizes a change-source name, raising on an unknown one so a typo fails loudly at definition/configuration time instead of silently disabling all maintenance for the view.
Class Method Details
.cast(source) ⇒ Object
Validates and normalizes a change-source name, raising on an unknown one so a typo fails loudly at definition/configuration time instead of silently disabling all maintenance for the view.
17 18 19 20 21 22 |
# File 'lib/activerecord/materialized/change_source.rb', line 17 def self.cast(source) name = source.to_sym return name if NAMES.include?(name) raise ArgumentError, "Unknown change source #{source.inspect} (expected one of #{NAMES.inspect})" end |