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']
DENY_LIST =
[:logged_changes, :password, :encrypted_password]

Instance Method Summary collapse

Instance Method Details

#reportable_attributesObject

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



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

def reportable_attributes
  all_reportable_attributes || {}
end

#reportable_emailObject

Something that returns an email



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

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 }



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

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



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

def reportable_view_assigns(view = nil)
  {}
end