Module: HowAreWeDoing::ActsAsAnalytical::ClassMethods

Defined in:
lib/how_are_we_doing/acts_as_analytical.rb

Instance Method Summary collapse

Instance Method Details

#acts_as_analyticalObject



9
10
11
12
13
14
15
16
17
18
19
20
# File 'lib/how_are_we_doing/acts_as_analytical.rb', line 9

def acts_as_analytical
  belongs_to "#{self.name.underscore}able".to_sym, :polymorphic => true
  belongs_to :user

  validates "#{self.name.underscore}able_type".to_sym, :presence => true, :on => :create
  validates "#{self.name.underscore}able_id".to_sym, :presence => true, :on => :create

  after_create :create_total
  
  include HowAreWeDoing::ActsAsAnalytical::InstanceMethods
  extend  HowAreWeDoing::ActsAsAnalytical::SingletonMethods
end