File tree 2 files changed +9
-2
lines changed
lib/money-rails/active_record
2 files changed +9
-2
lines changed Original file line number Diff line number Diff line change 1
1
# RubyMoney - Money-Rails
2
2
3
3
[ ![ 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 )
5
5
[ ![ License] ( http://img.shields.io/:license-mit-green.svg?style=flat )] ( http://opensource.org/licenses/MIT )
6
6
7
7
## Introduction
@@ -474,6 +474,12 @@ MoneyRails.configure do |config|
474
474
# symbol: nil,
475
475
# sign_before_symbol: nil
476
476
# }
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
477
483
end
478
484
```
479
485
493
499
* ` amount_column ` : Provide values for the amount column (holding the fractional part of a money object).
494
500
* ` currency_column ` : Provide default values or even disable (` present: false ` ) the currency column.
495
501
* ` 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
496
503
497
504
### Helpers
498
505
Original file line number Diff line number Diff line change @@ -10,7 +10,7 @@ class ReadOnlyCurrencyException < MoneyRails::Error; end
10
10
11
11
module ClassMethods
12
12
def monetized_attributes
13
- monetized_attributes = @monetized_attributes || { }
13
+ monetized_attributes = @monetized_attributes || { } . with_indifferent_access
14
14
15
15
if superclass . respond_to? ( :monetized_attributes )
16
16
monetized_attributes . merge ( superclass . monetized_attributes )
You can’t perform that action at this time.
0 commit comments