Skip to content

Commit 31c8fe5

Browse files
authored
Merge branch 'main' into chore/test-against-ruby-33
2 parents 9245799 + 7cc8e51 commit 31c8fe5

File tree

3 files changed

+10
-2
lines changed

3 files changed

+10
-2
lines changed

README.md

+8-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# RubyMoney - Money-Rails
22

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

77
## Introduction
@@ -474,6 +474,12 @@ MoneyRails.configure do |config|
474474
# symbol: nil,
475475
# sign_before_symbol: nil
476476
# }
477+
478+
# Set whether an error should be raised when parsing money values
479+
# This includes assigning to a monetized field with the wrong currency
480+
# Default value is false
481+
#
482+
# config.raise_error_on_money_parsing = true
477483
end
478484
```
479485

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

497504
### Helpers
498505

lib/money-rails/active_record/monetizable.rb

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ class ReadOnlyCurrencyException < MoneyRails::Error; end
1010

1111
module ClassMethods
1212
def monetized_attributes
13-
monetized_attributes = @monetized_attributes || {}
13+
monetized_attributes = @monetized_attributes || {}.with_indifferent_access
1414

1515
if superclass.respond_to?(:monetized_attributes)
1616
monetized_attributes.merge(superclass.monetized_attributes)

money-rails.gemspec

+1
Original file line numberDiff line numberDiff line change
@@ -42,5 +42,6 @@ Gem::Specification.new do |s|
4242
s.metadata['changelog_uri'] = 'https://github.com/RubyMoney/money-rails/blob/master/CHANGELOG.md'
4343
s.metadata['source_code_uri'] = 'https://github.com/RubyMoney/money-rails/'
4444
s.metadata['bug_tracker_uri'] = 'https://github.com/RubyMoney/money-rails/issues'
45+
s.metadata['rubygems_mfa_required'] = 'true'
4546
end
4647
end

0 commit comments

Comments
 (0)