| Module | ActiveWarehouse::SlowlyChangingDimension::ClassMethods |
| In: |
lib/active_warehouse/dimension/slowly_changing_dimension.rb
|
| find_every | -> | find_every_with_older |
| calculate | -> | calculate_with_older |
| validate_find_options | -> | core_validate_find_options |
Indicate that the dimension is a Type 2 Slowly Changing Dimension (SDC).
A word of warning:
The expiration_date field must never be null. For the current effective record use the maximum date allowed. This is necessary because the find query used when :valid_on is specified is implemented using a between clause.
Options:
# File lib/active_warehouse/dimension/slowly_changing_dimension.rb, line 37
37: def acts_as_slowly_changing_dimension(options = {})
38: unless slowly_changing_dimension? # don't let AR call this twice
39: cattr_accessor :identifier
40: cattr_accessor :latest_version_attribute
41: cattr_accessor :effective_date_attribute
42: cattr_accessor :expiration_date_attribute
43: self.identifier = options[:identifier] || :identifier
44: self.latest_version_attribute = options[:with] || :latest_version
45: self.effective_date_attribute = options[:effective_date_attribute] || :effective_date
46: self.expiration_date_attribute = options[:expiration_date_attribute] || :expiration_date
47: class << self
48: alias_method :find_every_with_older, :find_every
49: alias_method :calculate_with_older, :calculate
50: alias_method :core_validate_find_options, :validate_find_options
51: VALID_FIND_OPTIONS << :with_older
52: VALID_FIND_OPTIONS << :valid_on
53: VALID_FIND_OPTIONS << :valid_during
54: end
55: end
56: include InstanceMethods
57: end