Questions tagged [money-rails]

money-rails provides integration of the money gem with Ruby on Rails.

money-rails provides integration of the money gem with Ruby on Rails.

Both ActiveRecord and Mongoid are now supported.

For more information: https://github.com/RubyMoney/money-rails

86 questions
8
votes
3 answers

money-rails, Money#== supports only zero numerics

I'm using the money-rails gem in my Rails application. It have worked perfectly until now, but I've recently started getting the following error: Money#== supports only zero numerics I'm not really sure what caused this or how to solve it. I have…
Anders
  • 2,903
  • 7
  • 58
  • 114
6
votes
1 answer

Money-Rails Gem - instance currencies

I have a model in my rails 4 app called funding. I am using Money Rails to handle money/currency components - https://github.com/RubyMoney/money-rails My funding model has 3 funding attributes called amount_expenses, amount_honorarium and…
Mel
  • 2,481
  • 26
  • 113
  • 273
5
votes
2 answers

connection_config deprecated warning with RSpec after migrating to Rails 6.1

I upgraded an app to Rails 6.1.0 (from 6.0.3.3, by creating a new api-only app, adding RSpec, then copying needed files over manually). I am seeing the following warning when I run RSpec: DEPRECATION WARNING: connection_config is deprecated and will…
5
votes
5 answers

Money-Rails Gem: Humanized_money in Models

In my Donations Model, I have monetized the amount_cents column I need the humanized version of the donation amount (Eg. 643.50) in the Model so I can generate and send a PDF receipt to the donor. I've tried humanized_money(self.amount) and…
Michael Victor
  • 861
  • 2
  • 18
  • 42
5
votes
1 answer

Using money-rails: How to manually set an attribute's currency

I'm currently using: money-rails v0.12.0 rails v4.1.6 ruby v2.1.3 Use case I'm updating a money type attribute called dollars_per_month, which I created with the money-rails migration helpers (i.e add_money). So, in my model I have: monetize…
5
votes
3 answers

Money-Rails Gem: How to make a select list for all currencies?

I'm using the money-rails gem and want to show in my view a list of different currencies but the code I have now isn't working. I have my Price model and the fields in_cents and currency: create_table :prices do |t| t.integer :in_cents, default:…
user2784630
  • 796
  • 1
  • 8
  • 19
4
votes
3 answers

How to get the exchange currency exchange rate in rails?

I tried to get the exchange rate like this in my Rails app : 1.to_money.exchange_to('USD') (Note : I have set the default currency to my local currency which is lkr). This returns 0. Im using the money-rails gem.
THpubs
  • 7,804
  • 16
  • 68
  • 143
4
votes
3 answers

Money-Rails Gem with Rails 4 - Instance Currencies

Im trying to use monetise in my Rails 4 app (with money-rails gem). How do you allow a user to submit a number dollars only? When I input 100 I get $1 instead of $100. In my model, I have: monetize :participation_cost_pennies, with_model_currency:…
Mel
  • 2,481
  • 26
  • 113
  • 273
4
votes
0 answers

rails money managing currency thru a parent model

Using the money-rails gem https://github.com/RubyMoney/money-rails I've previously been using the with_model_currency method: delegate :currency, :to => :edition, :prefix => true monetize :base_fee_pennies, :allow_nil => true, :with_model_currency…
holden
  • 13,471
  • 22
  • 98
  • 160
3
votes
1 answer

EU Central Bank Gem redirection forbidden

Currently I am receiving an error message from eu central bank gem on rails as; 2018-09-06T18:26:20.629896+00:00 app[web.1]: Error ID: 79f8e4f3 2018-09-06T18:26:20.629903+00:00 app[web.1]: Error details saved to:…
Shalafister's
  • 761
  • 1
  • 7
  • 34
3
votes
1 answer

Allowing both comma or dot in currency parameter

I have this in my model: monetize :advance_amount_cents, allow_nil: true monetize :rental_amount_cents, allow_nil: true I use AutoNumeric to display the currency. It sends it back to the controller like this in params: 'rental_amount' =…
rept
  • 2,086
  • 1
  • 26
  • 44
3
votes
2 answers

Rails money round cents up

I'm trying to round my money without cents, but I want the amount to be rounded up always (ceil). I've done: MoneyRails.configure do |config| config.rounding_mode = BigDecimal::ROUND_CEILING end Money.new(12345).format(:no_cents) But it still…
fedest
  • 1,190
  • 3
  • 15
  • 35
3
votes
0 answers

Solidus 2.0.0 and currency symbol_position not working

I am having difficulties to change the symbol position from "$ 100.00" to "100.00 $" in Solidus 2.0.0 I overided app/lib/spree/money.rb and I have added this line for self.default_formatting_rules = { symbol_position: :after } and basically when…
Jonathan Chevalier
  • 993
  • 1
  • 9
  • 18
3
votes
1 answer

Get list of monetized fields in money-rails

Is there a way to get an array of money fields defined with monetize? I need them for some metaprogramming
Paul Odeon
  • 4,407
  • 1
  • 37
  • 37
3
votes
1 answer

How to prevent Ruby money floating point errors

I'm using Rails with the money-rails gem to handle money columns. Is there any way to prevent floating point errors from occuring? (even a hack will do, I just want to make sure no such errors are presented to the end user) Rspec example case: it…
Spyros Mandekis
  • 984
  • 1
  • 14
  • 32
1
2 3 4 5 6