Skip to content

Commit

Permalink
update RoR documentation to favor money-rails
Browse files Browse the repository at this point in the history
  • Loading branch information
semmons99 committed Sep 26, 2012
1 parent 83ac0f7 commit 8f77375
Showing 1 changed file with 2 additions and 24 deletions.
26 changes: 2 additions & 24 deletions README.md
Expand Up @@ -231,28 +231,6 @@ implementations.

## Ruby on Rails

To integrate money in a Rails application use [money-rails](http://github.com/RubyMoney/money-rails)
gem or follow the instructions below.
To integrate money in a Rails application use [money-rails](http://github.com/RubyMoney/money-rails).

Define accessor methods to let Active Record deal with embedding the money
object in your models. The following example requires 2 columns:

``` ruby
:price_cents, :integer, :default => 0, :null => false
:price_currency, :string
```

Then in your model file:

``` ruby
def price
Money.new price_cents || 0, price_currency || Money.default_currency
end

def price=(value)
Money.parse(value).tap do |price|
write_attribute :price_cents, price.cents
write_attribute :price_currency, price.currency_as_string
end
end
```
For depreceated methods of integrating with Rails, check [the wiki](https://github.com/RubyMoney/money/wiki).

2 comments on commit 8f77375

@semmons99
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey @alup, I finally went ahead and made money-rails the defacto rails integration tool. Thanks for you hard work on the it!

@alup
Copy link
Member

@alup alup commented on 8f77375 Sep 26, 2012

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@semmons99 👍 super!!!

Please sign in to comment.