Class: ActiveRecord::Materialized::View
- Inherits:
-
Base
- Object
- Base
- ActiveRecord::Materialized::View
- Defined in:
- lib/activerecord/materialized/view.rb
Overview
The base class for an application-level materialized view. Subclass it,
point ActiveRecord::Materialized::ViewConfigurationClassMethods::ClassMethods#materialized_from at an
ActiveRecord::Relation, declare the models it
depends_on, and then
read it like any ActiveRecord model. Reads are served from a cache table the
gem maintains incrementally as the underlying data changes; a full
materialization happens only via an explicit
rebuild!, and until then
reads transparently fall through to the source query.
Class Attribute Summary collapse
-
.max_staleness_setting ⇒ Object
readonly
Returns the value of attribute max_staleness_setting.
-
.source_definition ⇒ Object
readonly
Returns the value of attribute source_definition.
Class Method Summary collapse
Instance Method Summary collapse
Methods included from ViewQueryAccessClassMethods
Methods included from ViewConfigurationClassMethods
Methods included from RefreshCallbacks
Class Attribute Details
.max_staleness_setting ⇒ Object (readonly)
Returns the value of attribute max_staleness_setting.
55 56 57 |
# File 'lib/activerecord/materialized/view.rb', line 55 def max_staleness_setting @max_staleness_setting end |
.source_definition ⇒ Object (readonly)
Returns the value of attribute source_definition.
55 56 57 |
# File 'lib/activerecord/materialized/view.rb', line 55 def source_definition @source_definition end |
Class Method Details
.dependency_tables ⇒ Object
57 58 59 60 |
# File 'lib/activerecord/materialized/view.rb', line 57 def dependency_tables tables = instance_variable_get(:@dependency_tables) tables.nil? ? [] : tables end |
Instance Method Details
#stale? ⇒ Boolean
63 64 65 |
# File 'lib/activerecord/materialized/view.rb', line 63 def stale? self.class.stale? end |