Module: Mongoid::Monetize::ClassMethods
- Defined in:
- lib/money/mongoid/monetize.rb
Instance Method Summary collapse
-
#monetize_many(name, options = {:as => :priced}) ⇒ Object
alias_method :monetize, :monetize_one.
- #monetize_one(name, options = {:as => :priced}) ⇒ Object
Instance Method Details
#monetize_many(name, options = {:as => :priced}) ⇒ Object
alias_method :monetize, :monetize_one
20 21 22 23 24 25 26 |
# File 'lib/money/mongoid/monetize.rb', line 20 def monetize_many name, = {:as => :priced} as_poly = .delete(:as) || default_polymorphic_money unless as_poly raise ArgumentError, "You must set an :as option indicating the polymorphic Monetizable model. See money-rails gem." end self. name, .merge(:as => as_poly) end |
#monetize_one(name, options = {:as => :priced}) ⇒ Object
9 10 11 12 13 14 15 16 17 |
# File 'lib/money/mongoid/monetize.rb', line 9 def monetize_one name, = {:as => :priced} as_poly = .delete(:as) || default_polymorphic_money unless as_poly raise ArgumentError, "You must set an :as option indicating the polymorphic Monetizable model - was: #{}. See money-rails gem." end self. name.to_sym, .merge(:as => as_poly) end |