Skip to content

Commit

Permalink
Merge branch 'main' into fix-money-only-cents-for-negative-money
Browse files Browse the repository at this point in the history
  • Loading branch information
semmons99 authored Mar 13, 2024
2 parents f9e6081 + 44def3e commit 9363e10
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
9 changes: 8 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# RubyMoney - Money-Rails

[![Gem Version](https://badge.fury.io/rb/money-rails.svg)](http://badge.fury.io/rb/money-rails)
[![Build Status](https://secure.travis-ci.org/RubyMoney/money-rails.svg?branch=master)](http://travis-ci.org/RubyMoney/money-rails)
[![Ruby](https://github.com/RubyMoney/money-rails/actions/workflows/ruby.yml/badge.svg)](https://github.com/RubyMoney/money-rails/actions/workflows/ruby.yml)
[![License](http://img.shields.io/:license-mit-green.svg?style=flat)](http://opensource.org/licenses/MIT)

## Introduction
Expand Down Expand Up @@ -474,6 +474,12 @@ MoneyRails.configure do |config|
# symbol: nil,
# sign_before_symbol: nil
# }

# Set whether an error should be raised when parsing money values
# This includes assigning to a monetized field with the wrong currency
# Default value is false
#
# config.raise_error_on_money_parsing = true
end
```

Expand All @@ -493,6 +499,7 @@ end
* `amount_column`: Provide values for the amount column (holding the fractional part of a money object).
* `currency_column`: Provide default values or even disable (`present: false`) the currency column.
* `rounding_mode`: Set `Money.rounding_mode` to one of the BigDecimal constants.
* `raise_error_on_money_parsing`: Set whether errors should be raised when parsing money values

### Helpers

Expand Down
2 changes: 1 addition & 1 deletion lib/money-rails/active_record/monetizable.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ class ReadOnlyCurrencyException < MoneyRails::Error; end

module ClassMethods
def monetized_attributes
monetized_attributes = @monetized_attributes || {}
monetized_attributes = @monetized_attributes || {}.with_indifferent_access

if superclass.respond_to?(:monetized_attributes)
monetized_attributes.merge(superclass.monetized_attributes)
Expand Down

0 comments on commit 9363e10

Please sign in to comment.