money-rails 1.13.4 → 1.14.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGELOG.md +4 -0
- data/LICENSE +18 -18
- data/README.md +1 -1
- data/Rakefile +7 -0
- data/lib/money-rails/active_model/validator.rb +2 -2
- data/lib/money-rails/active_record/migration_extensions/schema_statements_pg_rails4.rb +2 -1
- data/lib/money-rails/active_record/migration_extensions/table_pg_rails4.rb +2 -1
- data/lib/money-rails/version.rb +1 -1
- data/money-rails.gemspec +1 -0
- data/spec/dummy/db/schema.rb +30 -31
- metadata +20 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 8226863e954671b603c22fac3eae1667b81ba88eb3425b8c9cd798e2cfa2f303
|
4
|
+
data.tar.gz: cc9c7c8fbc27bcc9343ad457f596b15594a576d0da93448d3bfbabe1caedcfbb
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0ed641980d3b776a3b2ec80d9ff1e7247415248eeff0bdc3fbc7077ad7700171fdcbda6c4c13bf39c2cda063a9fdf2575b660f9625fb506e8d39a815b96ab02f
|
7
|
+
data.tar.gz: 301fbd73c779ac54d60e1be7137df6e0a89974b0372d1667fe9eb69c2a8e40c309768bcda6d885f1d6e7168512d2e62a61562ea2189dcd1bba14c53d58b1b891
|
data/CHANGELOG.md
CHANGED
data/LICENSE
CHANGED
@@ -1,22 +1,22 @@
|
|
1
|
-
Copyright (c) 2012 Andreas Loupasakis
|
2
|
-
|
3
1
|
MIT License
|
4
2
|
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
3
|
+
Copyright (c) 2012 Andreas Loupasakis
|
4
|
+
Copyright (c) 2021 Shane Emmons
|
5
|
+
|
6
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
7
|
+
of this software and associated documentation files (the "Software"), to deal
|
8
|
+
in the Software without restriction, including without limitation the rights
|
9
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
10
|
+
copies of the Software, and to permit persons to whom the Software is
|
11
|
+
furnished to do so, subject to the following conditions:
|
12
12
|
|
13
|
-
The above copyright notice and this permission notice shall be
|
14
|
-
|
13
|
+
The above copyright notice and this permission notice shall be included in all
|
14
|
+
copies or substantial portions of the Software.
|
15
15
|
|
16
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
OF
|
22
|
-
|
16
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
17
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
18
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
19
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
20
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
21
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
22
|
+
SOFTWARE.
|
data/README.md
CHANGED
data/Rakefile
CHANGED
@@ -55,6 +55,13 @@ namespace :spec do
|
|
55
55
|
framework, version = file_name.split(/(\d+)/)
|
56
56
|
major, minor = version.split(//)
|
57
57
|
|
58
|
+
# Ruby 3 exclusions
|
59
|
+
if Gem::Version.new(RUBY_VERSION) >= Gem::Version.new('3.0.0')
|
60
|
+
# Rails 5 does not support ruby-3.0.0 https://github.com/rails/rails/issues/40938#issuecomment-751569171
|
61
|
+
# Mongoid gem does not yet support ruby-3.0.0 https://github.com/mongodb/mongoid#compatibility
|
62
|
+
next if framework == 'mongoid' || (framework == 'rails' && version == "5")
|
63
|
+
end
|
64
|
+
|
58
65
|
frameworks_versions[framework] ||= []
|
59
66
|
frameworks_versions[framework] << file_name
|
60
67
|
|
@@ -79,12 +79,12 @@ module MoneyRails
|
|
79
79
|
attr_name = attr.to_s.tr('.', '_').humanize
|
80
80
|
attr_name = record.class.human_attribute_name(attr, default: attr_name)
|
81
81
|
|
82
|
-
record.errors.add(attr, :invalid_currency,
|
82
|
+
record.errors.add(attr, :invalid_currency,
|
83
83
|
thousands: details.thousands_separator,
|
84
84
|
decimal: details.decimal_mark,
|
85
85
|
currency: details.abs_raw_value,
|
86
86
|
attribute: attr_name
|
87
|
-
|
87
|
+
)
|
88
88
|
end
|
89
89
|
|
90
90
|
def value_has_too_many_decimal_points(details)
|
@@ -5,7 +5,8 @@ module MoneyRails
|
|
5
5
|
def add_monetize(table_name, accessor, options={})
|
6
6
|
[:amount, :currency].each do |attribute|
|
7
7
|
column_present, *opts = OptionsExtractor.extract attribute, table_name, accessor, options
|
8
|
-
|
8
|
+
constraints = opts.pop
|
9
|
+
add_column(*opts, **constraints) if column_present
|
9
10
|
end
|
10
11
|
end
|
11
12
|
|
@@ -5,7 +5,8 @@ module MoneyRails
|
|
5
5
|
def monetize(accessor, options={})
|
6
6
|
[:amount, :currency].each do |attribute|
|
7
7
|
column_present, _, *opts = OptionsExtractor.extract attribute, :no_table, accessor, options
|
8
|
-
|
8
|
+
constraints = opts.pop
|
9
|
+
column(*opts, **constraints) if column_present
|
9
10
|
end
|
10
11
|
end
|
11
12
|
|
data/lib/money-rails/version.rb
CHANGED
data/money-rails.gemspec
CHANGED
@@ -36,6 +36,7 @@ Gem::Specification.new do |s|
|
|
36
36
|
s.add_development_dependency "rspec-rails", "~> 3.0"
|
37
37
|
s.add_development_dependency 'database_cleaner', '~> 1.6.1'
|
38
38
|
s.add_development_dependency 'test-unit', '~> 3.0' if RUBY_VERSION >= '2.2'
|
39
|
+
s.add_development_dependency 'bundler'
|
39
40
|
|
40
41
|
if s.respond_to?(:metadata)
|
41
42
|
s.metadata['changelog_uri'] = 'https://github.com/RubyMoney/money-rails/blob/master/CHANGELOG.md'
|
data/spec/dummy/db/schema.rb
CHANGED
@@ -1,60 +1,59 @@
|
|
1
|
-
# encoding: UTF-8
|
2
1
|
# This file is auto-generated from the current state of the database. Instead
|
3
2
|
# of editing this file, please use the migrations feature of Active Record to
|
4
3
|
# incrementally modify your database, and then regenerate this schema definition.
|
5
4
|
#
|
6
|
-
#
|
7
|
-
#
|
8
|
-
#
|
9
|
-
# from scratch.
|
10
|
-
#
|
5
|
+
# This file is the source Rails uses to define your schema when running `bin/rails
|
6
|
+
# db:schema:load`. When creating a new database, `bin/rails db:schema:load` tends to
|
7
|
+
# be faster and is potentially less error prone than running all of your
|
8
|
+
# migrations from scratch. Old migrations may fail to apply correctly if those
|
9
|
+
# migrations use external dependencies or application code.
|
11
10
|
#
|
12
11
|
# It's strongly recommended that you check this file into your version control system.
|
13
12
|
|
14
|
-
ActiveRecord::Schema.define(version:
|
13
|
+
ActiveRecord::Schema.define(version: 2015_10_26_220420) do
|
15
14
|
|
16
15
|
create_table "dummy_products", force: :cascade do |t|
|
17
|
-
t.string
|
18
|
-
t.integer
|
16
|
+
t.string "currency"
|
17
|
+
t.integer "price_cents"
|
19
18
|
t.datetime "created_at"
|
20
19
|
t.datetime "updated_at"
|
21
20
|
end
|
22
21
|
|
23
22
|
create_table "products", force: :cascade do |t|
|
24
|
-
t.integer
|
25
|
-
t.integer
|
23
|
+
t.integer "price_cents"
|
24
|
+
t.integer "discount"
|
26
25
|
t.datetime "created_at"
|
27
26
|
t.datetime "updated_at"
|
28
|
-
t.integer
|
29
|
-
t.integer
|
30
|
-
t.integer
|
31
|
-
t.string
|
32
|
-
t.integer
|
33
|
-
t.integer
|
34
|
-
t.integer
|
35
|
-
t.integer
|
36
|
-
t.integer
|
37
|
-
t.integer
|
38
|
-
t.string
|
39
|
-
t.integer
|
40
|
-
t.integer
|
41
|
-
t.string
|
27
|
+
t.integer "bonus_cents"
|
28
|
+
t.integer "optional_price_cents"
|
29
|
+
t.integer "sale_price_amount", default: 0, null: false
|
30
|
+
t.string "sale_price_currency_code"
|
31
|
+
t.integer "price_in_a_range_cents"
|
32
|
+
t.integer "validates_method_amount_cents"
|
33
|
+
t.integer "aliased_cents"
|
34
|
+
t.integer "delivery_fee_cents"
|
35
|
+
t.integer "restock_fee_cents"
|
36
|
+
t.integer "reduced_price_cents"
|
37
|
+
t.string "reduced_price_currency"
|
38
|
+
t.integer "special_price_cents"
|
39
|
+
t.integer "lambda_price_cents"
|
40
|
+
t.string "skip_validation_price_cents"
|
42
41
|
end
|
43
42
|
|
44
43
|
create_table "services", force: :cascade do |t|
|
45
|
-
t.integer
|
46
|
-
t.integer
|
44
|
+
t.integer "charge_cents"
|
45
|
+
t.integer "discount_cents"
|
47
46
|
t.datetime "created_at"
|
48
47
|
t.datetime "updated_at"
|
49
48
|
end
|
50
49
|
|
51
50
|
create_table "transactions", force: :cascade do |t|
|
52
|
-
t.integer
|
53
|
-
t.integer
|
54
|
-
t.string
|
51
|
+
t.integer "amount_cents"
|
52
|
+
t.integer "tax_cents"
|
53
|
+
t.string "currency"
|
55
54
|
t.datetime "created_at"
|
56
55
|
t.datetime "updated_at"
|
57
|
-
t.integer
|
56
|
+
t.integer "optional_amount_cents"
|
58
57
|
end
|
59
58
|
|
60
59
|
end
|
metadata
CHANGED
@@ -1,16 +1,16 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: money-rails
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.14.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Andreas Loupasakis
|
8
8
|
- Shane Emmons
|
9
9
|
- Simone Carletti
|
10
|
-
autorequire:
|
10
|
+
autorequire:
|
11
11
|
bindir: bin
|
12
12
|
cert_chain: []
|
13
|
-
date: 2021-
|
13
|
+
date: 2021-03-02 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: money
|
@@ -124,6 +124,20 @@ dependencies:
|
|
124
124
|
- - "~>"
|
125
125
|
- !ruby/object:Gem::Version
|
126
126
|
version: '3.0'
|
127
|
+
- !ruby/object:Gem::Dependency
|
128
|
+
name: bundler
|
129
|
+
requirement: !ruby/object:Gem::Requirement
|
130
|
+
requirements:
|
131
|
+
- - ">="
|
132
|
+
- !ruby/object:Gem::Version
|
133
|
+
version: '0'
|
134
|
+
type: :development
|
135
|
+
prerelease: false
|
136
|
+
version_requirements: !ruby/object:Gem::Requirement
|
137
|
+
requirements:
|
138
|
+
- - ">="
|
139
|
+
- !ruby/object:Gem::Version
|
140
|
+
version: '0'
|
127
141
|
description: This library provides integration of RubyMoney - Money gem with Rails
|
128
142
|
email:
|
129
143
|
- alup.rubymoney@gmail.com
|
@@ -236,7 +250,7 @@ metadata:
|
|
236
250
|
changelog_uri: https://github.com/RubyMoney/money-rails/blob/master/CHANGELOG.md
|
237
251
|
source_code_uri: https://github.com/RubyMoney/money-rails/
|
238
252
|
bug_tracker_uri: https://github.com/RubyMoney/money-rails/issues
|
239
|
-
post_install_message:
|
253
|
+
post_install_message:
|
240
254
|
rdoc_options: []
|
241
255
|
require_paths:
|
242
256
|
- lib
|
@@ -251,8 +265,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
251
265
|
- !ruby/object:Gem::Version
|
252
266
|
version: '0'
|
253
267
|
requirements: []
|
254
|
-
rubygems_version: 3.
|
255
|
-
signing_key:
|
268
|
+
rubygems_version: 3.2.3
|
269
|
+
signing_key:
|
256
270
|
specification_version: 4
|
257
271
|
summary: Money gem integration with Rails
|
258
272
|
test_files:
|