compatibility with money gem

64 views
Skip to first unread message

Gordon Lo

unread,
Apr 9, 2014, 11:37:42 AM4/9/14
to plutu...@googlegroups.com
I am working on a Rails 4.0 project that is dependant on money gem, and I've been using money.cents and money.currency. In other words, I have all of my amounts stored in cents, e.g. amount_cents, total_cents. 

Do I need any workarounds when implementing plutus-gem, since you stored amount value as BigDecimal? Thanks.

mbulat

unread,
Apr 9, 2014, 3:14:22 PM4/9/14
to plutu...@googlegroups.com
If you're using a money gem version greater 6.0, then `money.amount` will returns a BigDecimal which you can use with plutus, ie:

entry = Plutus::Entry.build(
               
:description => "Order placed for widgets",
               
:debits => [
                 
{:account => "Cash", :amount => money.amount}],
               
:credits => [
                 
{:account => "Unearned Revenue", :amount => money.amount}])
Reply all
Reply to author
Forward
0 new messages