module ActiveReporting::ActiveRecordAdaptor

This is included into every class that inherits from ActiveRecord::Base

Public Instance Methods

fact_model() click to toggle source

Returns the ActiveReporting::FactModel related to the model.

If one is not explictily defined, a constant will be created which inherits from ActiveReporting::Factmodel named [MyModel]FactModel

@return [ActiveReporting::FactModel]

# File lib/active_reporting/active_record_adaptor.rb, line 12
def fact_model
  const_name = "#{name}FactModel"
  @fact_model ||= begin
                    const_name.constantize
                  rescue NameError
                    const = Object.const_set(const_name, Class.new(ActiveReporting::FactModel))
                    const.model = self
                    const
                  end
end