module Money::Attributes::ClassMethods

Protected Instance Methods

money(field_name) click to toggle source
Calls superclass method
# File lib/money/attributes.rb, line 11
def money(field_name)
  define_method(field_name) do
    Money.new(super(), currency.code, date)
  end
  define_method("#{field_name}=") do |value|
    if value.kind_of?(Money)
      super(value.amount)
    else
      super(value)
    end
  end
end