Module: Ruport::Reportable::ClassMethods

Defined in:
lib/ruport/acts_as_reportable.rb

Overview

Overview

This module contains class methods that will automatically be available to ActiveRecord models.

Instance Method Summary collapse

Instance Method Details

#acts_as_reportable(options = {}) ⇒ Object

In the ActiveRecord model you wish to integrate with Ruport, add the following line just below the class definition:

acts_as_reportable

Available options:

:only

an attribute name or array of attribute names to include in the results, other attributes will be excuded.

:except

an attribute name or array of attribute names to exclude from the results.

:methods

a method name or array of method names whose result(s) will be included in the table.

:include

an associated model or array of associated models to include in the results.

Example:

class Book < ActiveRecord::Base
  acts_as_reportable, :only => 'title', :include => :author
end

73
74
75
76
77
78
79
80
# File 'lib/ruport/acts_as_reportable.rb', line 73

def acts_as_reportable(options = {})
  cattr_accessor :aar_options, :aar_columns

  self.aar_options = options

  include Ruport::Reportable::InstanceMethods
  extend Ruport::Reportable::SingletonMethods
end