Dollars And Cents plugin

Plugin details

A transparent handler for storing monetary values as integer fields in a database.

Websitehttp://blog.codahale.com/2006/05/18/dollars_and_cents-a-rails-plugin/ Repositoryhttp://svn.codahale.com/dollars_and_cents/ Author Coda Hale Tags Database, integer, price LicenseMIT

Documentation

Install the plugin:
ruby script/plugin install http://svn.codahale.com/dollars_and_cents/

Usage
========

In this example, let's assume we have a price we need to store in our database.

1. Create a database field named price_in_cents, of type INTEGER.
2. Access the price as follows:

    @product.price          #=> 29.99
    @product.price = 24.99  #=> 24.99
    @product.price          #=> 24.99

Further Documentation

There is currently no advanced documentation for this plugin.

New documentation

Edit plugin | Back in time (1 older version) | Last edited by: scott, 6 months ago