Module: ActsAsReportable

Extended by:
ActiveSupport::Concern
Defined in:
app/models/concerns/acts_as_reportable.rb

Overview

ActsAsReportable

Mark your model with ‘acts_as_reportable’ to be included in the reports

Defined Under Namespace

Modules: Base, ClassMethods

Constant Summary collapse

PRICE_NAME_ATTRIBUTES =
['price', 'subtotal', 'tax', 'total', 'current_revenue', 'current_revenue_subtotal', 'current_revenue_tax', 'deferred_revenue', 'deferred_revenue_subtotal', 'deferred_revenue_tax', 'amount_owing', 'surcharge']

Instance Method Summary collapse

Instance Method Details

#reportable_attributesObject

{ id: :integer, price: :price, created_at: :date }



23
24
25
# File 'app/models/concerns/acts_as_reportable.rb', line 23

def reportable_attributes
  all_reportable_attributes || {}
end

#reportable_emailObject

Something that returns an email



33
34
35
# File 'app/models/concerns/acts_as_reportable.rb', line 33

def reportable_email
  try(:email) || try(:user).try(:email) || try(:owner).try(:email) || raise("No reportable_email found")
end

#reportable_scopesObject

{ active: nil, inactive: nil, with_first_name: :string, not_in_good_standing: :boolean }



28
29
30
# File 'app/models/concerns/acts_as_reportable.rb', line 28

def reportable_scopes
  {}
end

#reportable_view_assigns(view = nil) ⇒ Object

Used for the notifications mailer This should be a view_context that you can call urls on But it’s a bit weird and sometimes it’s just nil (like on an update action in the validation) Be careful when you code stuff for it Always return all the keys, and leave the value blank if view is blank



42
43
44
# File 'app/models/concerns/acts_as_reportable.rb', line 42

def reportable_view_assigns(view = nil)
  {}
end