money-rails 1.8.0 → 1.9.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 73ee4855c001933ab0c12f74417f5696a856dbc9
4
- data.tar.gz: a733be5b1554565d6142bcf2ab047ed8290c176f
3
+ metadata.gz: efddf2fd0ce930972e24427f75fa976a18f915a6
4
+ data.tar.gz: a3ee629c92a46b729b6beb2eaeae7f6beb8166da
5
5
  SHA512:
6
- metadata.gz: 2478a1cab8317060f5ae05c8e3756a465b621e014e0156aa45a420fabfea85d2f8bbd7ea5d1deaaabbd7b33f4105bea382d7cf6759608b1634738f4b9467aa2c
7
- data.tar.gz: 08e5e5e699fbd4e7ffd5a09a1565a5c92197369b5cbead24184f0899affcbf9138d57e7358def34d11be25b6b593edb6aad12641ac315fb8b4e3b8c84e094f26
6
+ metadata.gz: 61d164c6d684028064e48d7a8b179c09eec0d31b968e2f8471dee8d013b84dae0cc8929cf14a2ba69d04daaaedbc31002c8345c75bb2de0981f3de16b7ba4ad5
7
+ data.tar.gz: dbadb3bde17a75b27ceaac420fd6c41859150c34dc1730410c43fcf38789f4cacb3099d34b1d8fe573d67916b776da3aacfd08569039fbd8502d528502ce8ebd
@@ -1,5 +1,11 @@
1
1
  # Changelog
2
2
 
3
+ ## 1.9.0
4
+
5
+ - Allow the use of money-rails with plan ActiveRecord (without Rails)
6
+ - Remove translation of postfix for the amount column (always use _cents by default)
7
+ - Push Monetize dependency from 1.6.0 to 1.7.0
8
+
3
9
  ## 1.8.0
4
10
 
5
11
  - Ruby 2.4 support
data/README.md CHANGED
@@ -23,7 +23,7 @@ welcome to contribute to the project.
23
23
 
24
24
  Add this line to your application's Gemfile:
25
25
 
26
- gem 'money-rails'
26
+ gem 'money-rails', '~>1'
27
27
 
28
28
  And then execute:
29
29
 
@@ -42,6 +42,12 @@ $ rails g money_rails:initializer
42
42
  There, you can define the default currency value and set other
43
43
  configuration parameters for the rails app.
44
44
 
45
+ Without Rails in rack-based applications, call during initialization:
46
+
47
+ ```ruby
48
+ MoneyRails::Hooks.init
49
+ ```
50
+
45
51
  ## Usage
46
52
 
47
53
  ### ActiveRecord
@@ -86,7 +92,8 @@ helper can be customized inside a ```MoneyRails.configure``` block. You should c
86
92
  ```ruby
87
93
  class MonetizeProduct < ActiveRecord::Migration
88
94
  def change
89
- add_money :products, :price
95
+ add_money :products, :price # Rails 3
96
+ add_monetize :products, :price # Rails 4x and above
90
97
 
91
98
  # OR
92
99
 
@@ -11,7 +11,7 @@ module MoneyRails
11
11
  extend Configuration
12
12
  end
13
13
 
14
- if defined? Rails
14
+ if defined? ::Rails::Railtie
15
15
  require "money-rails/railtie"
16
16
  require "money-rails/engine"
17
17
  end
@@ -27,7 +27,6 @@ module MoneyRails
27
27
  # Set default currency of money library
28
28
  def default_currency=(currency_name)
29
29
  Money.default_currency = currency_name
30
- set_amount_column_for_default_currency!
31
30
  set_currency_column_for_default_currency!
32
31
  end
33
32
 
@@ -36,10 +35,6 @@ module MoneyRails
36
35
  Money::Currency.register(currency_options)
37
36
  end
38
37
 
39
- def set_amount_column_for_default_currency!
40
- amount_column.merge! postfix: "_#{default_currency.subunit.downcase.pluralize}" if default_currency.subunit
41
- end
42
-
43
38
  def set_currency_column_for_default_currency!
44
39
  iso_code = default_currency.iso_code
45
40
  currency_column.merge! default: iso_code
@@ -8,17 +8,19 @@ module MoneyRails
8
8
  require 'money-rails/active_model/validator'
9
9
  require 'money-rails/active_record/monetizable'
10
10
  ::ActiveRecord::Base.send :include, MoneyRails::ActiveRecord::Monetizable
11
- if ::Rails::VERSION::MAJOR >= 4
12
- rails42 = case
13
- when ::Rails::VERSION::MAJOR < 5 && ::Rails::VERSION::MINOR >= 2
14
- true
15
- when ::Rails::VERSION::MAJOR >= 5
16
- true
17
- else
18
- false
19
- end
20
- current_adapter = ::ActiveRecord::Base.connection_config[:adapter]
21
- postgresql_with_money = rails42 && PG_ADAPTERS.include?(current_adapter)
11
+ if defined?(::ActiveRecord) && defined?(::ActiveRecord::VERSION)
12
+ if ::ActiveRecord::VERSION::MAJOR >= 4
13
+ rails42 = case
14
+ when ::ActiveRecord::VERSION::MAJOR < 5 && ::ActiveRecord::VERSION::MINOR >= 2
15
+ true
16
+ when ::ActiveRecord::VERSION::MAJOR >= 5
17
+ true
18
+ else
19
+ false
20
+ end
21
+ current_adapter = ::ActiveRecord::Base.connection_config[:adapter]
22
+ postgresql_with_money = rails42 && PG_ADAPTERS.include?(current_adapter)
23
+ end
22
24
  end
23
25
 
24
26
  require "money-rails/active_record/migration_extensions/options_extractor"
@@ -1,3 +1,3 @@
1
1
  module MoneyRails
2
- VERSION = '1.8.0'
2
+ VERSION = '1.9.0'
3
3
  end
@@ -26,8 +26,8 @@ Gem::Specification.new do |s|
26
26
 
27
27
  s.require_path = "lib"
28
28
 
29
- s.add_dependency "money", "~> 6.8.1"
30
- s.add_dependency "monetize", "~> 1.6.0"
29
+ s.add_dependency "money", "~> 6.9.0"
30
+ s.add_dependency "monetize", "~> 1.7.0"
31
31
  s.add_dependency "activesupport", ">= 3.0"
32
32
  s.add_dependency "railties", ">= 3.0"
33
33
  s.add_dependency "mime-types", "< 3" if RUBY_VERSION < '2.0' # mime-types > 3 depends on mime-types-data, which doesn't support ruby 1.9
@@ -93,7 +93,9 @@ describe "configuration" do
93
93
  old_currency = MoneyRails.default_currency
94
94
  MoneyRails.default_currency = :inr
95
95
 
96
- expect(MoneyRails.amount_column[:postfix]).to eq("_#{MoneyRails.default_currency.subunit.downcase.pluralize}")
96
+ expect(MoneyRails.default_currency.subunit).to eq 'Paisa'
97
+ expect(MoneyRails.amount_column[:postfix]).to eq("_cents") # not localized
98
+
97
99
  expect(MoneyRails.currency_column[:default]).to eq(MoneyRails.default_currency.iso_code)
98
100
 
99
101
  # Reset global setting
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: money-rails
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.8.0
4
+ version: 1.9.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Andreas Loupasakis
@@ -10,112 +10,126 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2017-01-23 00:00:00.000000000 Z
13
+ date: 2017-07-12 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: money
17
17
  requirement: !ruby/object:Gem::Requirement
18
18
  requirements:
19
- - - ~>
19
+ - - "~>"
20
20
  - !ruby/object:Gem::Version
21
- version: 6.8.1
21
+ version: 6.9.0
22
22
  type: :runtime
23
23
  prerelease: false
24
24
  version_requirements: !ruby/object:Gem::Requirement
25
25
  requirements:
26
- - - ~>
26
+ - - "~>"
27
27
  - !ruby/object:Gem::Version
28
- version: 6.8.1
28
+ version: 6.9.0
29
29
  - !ruby/object:Gem::Dependency
30
30
  name: monetize
31
31
  requirement: !ruby/object:Gem::Requirement
32
32
  requirements:
33
- - - ~>
33
+ - - "~>"
34
34
  - !ruby/object:Gem::Version
35
- version: 1.6.0
35
+ version: 1.7.0
36
36
  type: :runtime
37
37
  prerelease: false
38
38
  version_requirements: !ruby/object:Gem::Requirement
39
39
  requirements:
40
- - - ~>
40
+ - - "~>"
41
41
  - !ruby/object:Gem::Version
42
- version: 1.6.0
42
+ version: 1.7.0
43
43
  - !ruby/object:Gem::Dependency
44
44
  name: activesupport
45
45
  requirement: !ruby/object:Gem::Requirement
46
46
  requirements:
47
- - - '>='
47
+ - - ">="
48
48
  - !ruby/object:Gem::Version
49
49
  version: '3.0'
50
50
  type: :runtime
51
51
  prerelease: false
52
52
  version_requirements: !ruby/object:Gem::Requirement
53
53
  requirements:
54
- - - '>='
54
+ - - ">="
55
55
  - !ruby/object:Gem::Version
56
56
  version: '3.0'
57
57
  - !ruby/object:Gem::Dependency
58
58
  name: railties
59
59
  requirement: !ruby/object:Gem::Requirement
60
60
  requirements:
61
- - - '>='
61
+ - - ">="
62
62
  - !ruby/object:Gem::Version
63
63
  version: '3.0'
64
64
  type: :runtime
65
65
  prerelease: false
66
66
  version_requirements: !ruby/object:Gem::Requirement
67
67
  requirements:
68
- - - '>='
68
+ - - ">="
69
69
  - !ruby/object:Gem::Version
70
70
  version: '3.0'
71
71
  - !ruby/object:Gem::Dependency
72
72
  name: rails
73
73
  requirement: !ruby/object:Gem::Requirement
74
74
  requirements:
75
- - - '>='
75
+ - - ">="
76
76
  - !ruby/object:Gem::Version
77
77
  version: '3.0'
78
78
  type: :development
79
79
  prerelease: false
80
80
  version_requirements: !ruby/object:Gem::Requirement
81
81
  requirements:
82
- - - '>='
82
+ - - ">="
83
83
  - !ruby/object:Gem::Version
84
84
  version: '3.0'
85
85
  - !ruby/object:Gem::Dependency
86
86
  name: rspec-rails
87
87
  requirement: !ruby/object:Gem::Requirement
88
88
  requirements:
89
- - - ~>
89
+ - - "~>"
90
90
  - !ruby/object:Gem::Version
91
91
  version: '3.0'
92
92
  type: :development
93
93
  prerelease: false
94
94
  version_requirements: !ruby/object:Gem::Requirement
95
95
  requirements:
96
- - - ~>
96
+ - - "~>"
97
97
  - !ruby/object:Gem::Version
98
98
  version: '3.0'
99
99
  - !ruby/object:Gem::Dependency
100
100
  name: database_cleaner
101
101
  requirement: !ruby/object:Gem::Requirement
102
102
  requirements:
103
- - - '>='
103
+ - - ">="
104
104
  - !ruby/object:Gem::Version
105
105
  version: 0.8.0
106
- - - <
106
+ - - "<"
107
107
  - !ruby/object:Gem::Version
108
108
  version: 1.4.0
109
109
  type: :development
110
110
  prerelease: false
111
111
  version_requirements: !ruby/object:Gem::Requirement
112
112
  requirements:
113
- - - '>='
113
+ - - ">="
114
114
  - !ruby/object:Gem::Version
115
115
  version: 0.8.0
116
- - - <
116
+ - - "<"
117
117
  - !ruby/object:Gem::Version
118
118
  version: 1.4.0
119
+ - !ruby/object:Gem::Dependency
120
+ name: test-unit
121
+ requirement: !ruby/object:Gem::Requirement
122
+ requirements:
123
+ - - "~>"
124
+ - !ruby/object:Gem::Version
125
+ version: '3.0'
126
+ type: :development
127
+ prerelease: false
128
+ version_requirements: !ruby/object:Gem::Requirement
129
+ requirements:
130
+ - - "~>"
131
+ - !ruby/object:Gem::Version
132
+ version: '3.0'
119
133
  description: This library provides integration of RubyMoney - Money gem with Rails
120
134
  email:
121
135
  - alup.rubymoney@gmail.com
@@ -123,8 +137,14 @@ executables: []
123
137
  extensions: []
124
138
  extra_rdoc_files: []
125
139
  files:
140
+ - CHANGELOG.md
141
+ - LICENSE
142
+ - README.md
143
+ - Rakefile
144
+ - config/locales/money.en.yml
126
145
  - lib/generators/money_rails/initializer_generator.rb
127
146
  - lib/generators/templates/money.rb
147
+ - lib/money-rails.rb
128
148
  - lib/money-rails/active_model/validator.rb
129
149
  - lib/money-rails/active_record/migration_extensions/options_extractor.rb
130
150
  - lib/money-rails/active_record/migration_extensions/schema_statements.rb
@@ -144,11 +164,13 @@ files:
144
164
  - lib/money-rails/railtie.rb
145
165
  - lib/money-rails/test_helpers.rb
146
166
  - lib/money-rails/version.rb
147
- - lib/money-rails.rb
167
+ - money-rails.gemspec
148
168
  - spec/active_record/migration_extensions/schema_statements_spec.rb
149
169
  - spec/active_record/migration_extensions/table_spec.rb
150
170
  - spec/active_record/monetizable_spec.rb
151
171
  - spec/configuration_spec.rb
172
+ - spec/dummy/README.rdoc
173
+ - spec/dummy/Rakefile
152
174
  - spec/dummy/app/assets/javascripts/application.js
153
175
  - spec/dummy/app/assets/stylesheets/application.css
154
176
  - spec/dummy/app/controllers/application_controller.rb
@@ -159,6 +181,7 @@ files:
159
181
  - spec/dummy/app/models/service.rb
160
182
  - spec/dummy/app/models/transaction.rb
161
183
  - spec/dummy/app/views/layouts/application.html.erb
184
+ - spec/dummy/config.ru
162
185
  - spec/dummy/config/application.rb
163
186
  - spec/dummy/config/boot.rb
164
187
  - spec/dummy/config/database.yml
@@ -179,7 +202,6 @@ files:
179
202
  - spec/dummy/config/locales/it.yml
180
203
  - spec/dummy/config/mongoid.yml
181
204
  - spec/dummy/config/routes.rb
182
- - spec/dummy/config.ru
183
205
  - spec/dummy/db/migrate/20120331190108_create_products.rb
184
206
  - spec/dummy/db/migrate/20120402080348_add_bonus_cents_to_product.rb
185
207
  - spec/dummy/db/migrate/20120524052716_create_services.rb
@@ -202,8 +224,6 @@ files:
202
224
  - spec/dummy/public/422.html
203
225
  - spec/dummy/public/500.html
204
226
  - spec/dummy/public/favicon.ico
205
- - spec/dummy/Rakefile
206
- - spec/dummy/README.rdoc
207
227
  - spec/dummy/script/rails
208
228
  - spec/helpers/action_view_extension_spec.rb
209
229
  - spec/helpers/form_helper_spec.rb
@@ -214,12 +234,6 @@ files:
214
234
  - spec/spec_helper.rb
215
235
  - spec/support/database_cleaner.rb
216
236
  - spec/test_helpers_spec.rb
217
- - config/locales/money.en.yml
218
- - CHANGELOG.md
219
- - LICENSE
220
- - README.md
221
- - Rakefile
222
- - money-rails.gemspec
223
237
  homepage: https://github.com/RubyMoney/money-rails
224
238
  licenses:
225
239
  - MIT
@@ -230,17 +244,17 @@ require_paths:
230
244
  - lib
231
245
  required_ruby_version: !ruby/object:Gem::Requirement
232
246
  requirements:
233
- - - '>='
247
+ - - ">="
234
248
  - !ruby/object:Gem::Version
235
249
  version: '0'
236
250
  required_rubygems_version: !ruby/object:Gem::Requirement
237
251
  requirements:
238
- - - '>='
252
+ - - ">="
239
253
  - !ruby/object:Gem::Version
240
254
  version: '0'
241
255
  requirements: []
242
256
  rubyforge_project:
243
- rubygems_version: 2.0.14.1
257
+ rubygems_version: 2.6.8
244
258
  signing_key:
245
259
  specification_version: 4
246
260
  summary: Money gem integration with Rails
@@ -249,6 +263,8 @@ test_files:
249
263
  - spec/active_record/migration_extensions/table_spec.rb
250
264
  - spec/active_record/monetizable_spec.rb
251
265
  - spec/configuration_spec.rb
266
+ - spec/dummy/README.rdoc
267
+ - spec/dummy/Rakefile
252
268
  - spec/dummy/app/assets/javascripts/application.js
253
269
  - spec/dummy/app/assets/stylesheets/application.css
254
270
  - spec/dummy/app/controllers/application_controller.rb
@@ -259,6 +275,7 @@ test_files:
259
275
  - spec/dummy/app/models/service.rb
260
276
  - spec/dummy/app/models/transaction.rb
261
277
  - spec/dummy/app/views/layouts/application.html.erb
278
+ - spec/dummy/config.ru
262
279
  - spec/dummy/config/application.rb
263
280
  - spec/dummy/config/boot.rb
264
281
  - spec/dummy/config/database.yml
@@ -279,7 +296,6 @@ test_files:
279
296
  - spec/dummy/config/locales/it.yml
280
297
  - spec/dummy/config/mongoid.yml
281
298
  - spec/dummy/config/routes.rb
282
- - spec/dummy/config.ru
283
299
  - spec/dummy/db/migrate/20120331190108_create_products.rb
284
300
  - spec/dummy/db/migrate/20120402080348_add_bonus_cents_to_product.rb
285
301
  - spec/dummy/db/migrate/20120524052716_create_services.rb
@@ -302,8 +318,6 @@ test_files:
302
318
  - spec/dummy/public/422.html
303
319
  - spec/dummy/public/500.html
304
320
  - spec/dummy/public/favicon.ico
305
- - spec/dummy/Rakefile
306
- - spec/dummy/README.rdoc
307
321
  - spec/dummy/script/rails
308
322
  - spec/helpers/action_view_extension_spec.rb
309
323
  - spec/helpers/form_helper_spec.rb