Acts As Price Tag plugin

Plugin details

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.

Websitehttp://github.com/beezwax/acts-as-price-tag Repositorygit://github.com/beezwax/acts-as-price-tag.git Author Tobias Lutke Tags price LicenseMIT

Documentation

Install the plugin:
ruby script/plugin install git://github.com/beezwax/acts-as-price-tag.git

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
# => #
#    product.price = Money.new(55500, "USD")
# => #

Further Documentation

There is currently no advanced documentation for this plugin.

New documentation

Edit plugin | (0 older versions) | Last edited by: hardway, about 1 year ago