Module: Mongoid::Monetizable

Includes:
Money::Orm::Generic
Defined in:
lib/money/mongoid/monetizable.rb

Class Method Summary collapse

Methods included from Money::Orm::Generic

#currency, #price, #price=

Class Method Details

.included(base) ⇒ Object



7
8
9
10
11
12
13
14
15
# File 'lib/money/mongoid/monetizable.rb', line 7

def self.included(base)
	base.class_eval do
	  field :cents, 				:type => Integer, :default => 0
	  field :currency_iso, 	:type => String, 	:default => ::Money.default_currency.iso_code
	  
	  validates_numericality_of :cents
	end
	base.extend ::Money::Orm::Generic::ClassMethods				
end