Module: MoneyModelHelper

Included in:
Activity, EmployeeClientLaborRate, InvoicePayment, Payment
Defined in:
app/helpers/money_model_helper.rb

Class Method Summary collapse

Class Method Details

.append_features(base) ⇒ Object

THis module provides assistance to models which utilize the rails_money gem



4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
# File 'app/helpers/money_model_helper.rb', line 4

def self.append_features(base)
  super
  
  base.class_eval do
    
    # This prevents a NoMethodError: undefined method `amount_before_type_cast' error when validations kick-in
    def method_missing(symbol, *params)
      if (symbol.to_s =~ /^(.*)_before_type_cast$/)
       send $1
      else
       super
      end
    end
    
  end
end