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
1
vote
2 answers

How to have a model field inherit from another model?

I'm using the money-rails gem for currencies. I have two models: a User and a Goals model. The User model has a :currency field, which money-rails uses to set the currency for the user. The Goals model also has a :currency field. As it stands now,…
zenben1126
  • 685
  • 1
  • 7
  • 25
0
votes
0 answers

Money-rails gem rails and js dynamic select of dropdown

I have seed Country with name, number_code and iso. For Currency I have used money-rails gem. When I select Country I want user to autoselect its correspoinding currency. When I select USA auto selct USD and if user wants to chnage currency they can…
Sanju Basnet
  • 136
  • 2
  • 9
0
votes
0 answers

Are there any revenue sharing automation providers?

How do I facilitate revenue sharing automations that can forward a % of an incoming ACH amount onto another recipient based on original sender? For example, if Partner A sends me money, I want 10% of that to go to Sales Rep X. If Partner B sends me…
phaedrus
  • 11
  • 3
0
votes
1 answer

Using money-rails gem, switching instance currency to Euro breaks updates

I have a model named Widget that has a single monetized attribute named advance. Each instance of a Widget may have an advance attribute that stores a unique currency and amount. Despite setting up everything based on the gem documentation, and…
Randy Burgess
  • 4,835
  • 6
  • 41
  • 59
0
votes
0 answers

Partial cents and rounding errors in Money-Rails

I am working on an app that deals with ecommerce sales orders. We use the money-rails gem. Orders are imported from another system which may occasionally have numbers with partial cents. For example: Order Line Item quantity = 5 unit price =…
Isaac Y
  • 660
  • 1
  • 9
  • 27
0
votes
1 answer

How to make sortable column in ActiveAdmin?

I have column on index page in ActiveAdmin: column("Credit amount", sortable: true) {|u| u.credit_amount.format } I'm using gem money-rails for :credit_amount and .format method on index page for readability. But sorting doesn't work. How can I…
SsPay
  • 177
  • 1
  • 10
0
votes
1 answer

Using money-rails with mongoid: How to set currency per model instance

I'm currently using: money-rails v1.12 rails v6 mongoid v7 I would like to set the default currency to be used by each model instance. I have set the field in my model like below field :price, type: Money, with_model_currency: :currency But when I…
Jatto_abdul
  • 109
  • 2
  • 11
0
votes
0 answers

money-rails - rounding up method

I have this method below: def formatted_from_net_per_day return unless object.price.available? formatted_price_for(object.price.from_price) end As an example, it outputs: # The formatted_price_for…
drifterOcean19
  • 372
  • 5
  • 24
0
votes
2 answers

Rails store numbers with 2 decimal places after comma in database

I am doing PDFs for invoices in my system and I would like to be able to store numbers with two decimal places in the database. I am using MoneyRails gem for dealing with currencies, I have setup precision: 10 and scale: 2 on the database level (I…
jedi
  • 2,003
  • 5
  • 28
  • 66
0
votes
1 answer

Problems with money-rails in Ruby

I was following a tutorial to use money-rails in a new project. Here is my migration file: class AddFieldsToPlan < ActiveRecord::Migration[5.1] def change add_column :plans, :payment_gateway_plan_identifier, :string add_column :plans,…
Fernando Maymone
  • 355
  • 2
  • 15
0
votes
1 answer

Money-Rails not formatting thousands correctly for salaries

When I use money-rails for converting the integer hourly_wage_salary_cents column into a thousands money object. It removes 2 zeros from the number itself. Instead of getting $50,000, I am getting $500.00 or $500. How can I format the money object…
Johnny C
  • 121
  • 1
  • 1
  • 11
0
votes
1 answer

How do I work with dollar amounts not cents with Rails Money gem?

I'm trying to get the money-rails gem working, and I'm having problems... Other similar stackoverflow questions are 6 years old. Here's the product I have the appropriate columns on: class Transactions < ActiveRecord::Base belongs_to :user,…
jeancode
  • 5,856
  • 5
  • 12
  • 20
0
votes
1 answer

Is it possible to filter list of Ruby money currencies to only active ones?

I'm using the money gem for currency conversions in a Rails app and need to generate a list of currencies for a form select tag. The suggested documentation relies on getting calling Money::Currency.table to get a list of all currencies but this…
Tim Williams
  • 318
  • 2
  • 6
0
votes
2 answers

money rails gem, how to save 6 decimal to field

I have field monetize :unit_price_cents, as: 'unit_price', with_model_currency: :unit_price_currency It's type in database is float. And I want to save value in database keep 6 decimal value. in Money GEM, I custom success: Money.new(1.123456).to_f…
Peter89
  • 706
  • 8
  • 26
0
votes
3 answers

Running into undefined method `price_cents'

Have added money-rails gem to my app. Migrated its column to my model Item Migration class AddPriceToItems < ActiveRecord::Migration[5.0] def change add_column :items, :price, :money end end Model Item class Item < ApplicationRecord …
user273072545345
  • 1,536
  • 2
  • 27
  • 57