beezwax / acts-as-price-tag

This plugin adds a price methods (with currency support) to any active record object. It acts as a wrapper around Tobias Luetke's money gem.

This URL has Read+Write access

sam (author)
Sun Jun 08 15:37:49 -0700 2008
commit  d683164aec4ffccb230e769b2d85dc2fd68c4db0
tree    3bc62ffb75d338a4539ed6d3a801c3e8ed61e402
parent  42fcb84e97838ec7d5ad78168258e801b3ac83e0
name age message
file MIT-LICENSE Loading commit data...
file README
file Rakefile
file init.rb
file install.rb
directory lib/
directory tasks/
directory test/
file uninstall.rb
README
== Usage

This plugin adds price accessor and assignment methods to any active record object. 
It expects cents:integer and currency:string fields in the database.
The money functionality is drawn from ruby's money gem.
the price= method will accept a Money object or any object with a to_money method implemented.

#   class Product < ActiveRecord::Base
#     has_many :product_units
#     acts_as_price_tag
#   end
# 
#    product = Product.new
#    product.price = "EUR1000"
# => "EUR1000"
#    product.price
# => #<Money:0x235607c @currency="EUR", @cents=100000>
#    product.price = Money.new(55500, "USD")
# => #<Money:0x232ca9c @currency="USD", @cents=55500>

Money gem readme/license included in lib.