Skip to content

mesbahmilad/acts_as_currency

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

11 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

ActsAsCurrency

A plugin to turn any integer field into a currency, great for keeping accuracy on the fields.

Installation

To use it, add it to your Gemfile:

gem 'acts_as_currency', github: 'mesbahmilad/acts_as_currency' 

and bundle:

bundle

Post Installation

Usage

Setup

class Bill < ActiveRecord::Base
  acts_as_currency :total, :paid
end

@bill = Bill.new({:total=> 200.30, :paid=>102.34})

Overwrites the getter and setters for the given attributes to return the integer in the form of a decimal with 2 decimal points

@bill.total   # 200.30
@bill.paid    # 102.34

About

No description, website, or topics provided.

Resources

License

MIT, MIT licenses found

Licenses found

MIT
LICENSE
MIT
MIT-LICENSE

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published