active_currency 1.2.1 → 1.3.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
  SHA256:
3
- metadata.gz: 938c7b875052bf9d26b9ade8d9f1f268a94da7949a1685961a4265b01ed70a1c
4
- data.tar.gz: cd167c1b911156c2025d75b29be92cfdfceed15aac7533b736db5bb63a59d3bc
3
+ metadata.gz: 6712c0205342cb855a5c816cbcf29a9d2d81266f12b34cf580055e4ad66977fe
4
+ data.tar.gz: a8b33afc0657a7164bffa81fc6d0fa7115c6863d30af7fe2f52b93d223a51998
5
5
  SHA512:
6
- metadata.gz: 51af4e890792d65780f3ce822ca6bef58465b2a34578b7edb0c6776d8d104ba569ef282dd7004715944e7d388b44a3935c5e0659ae87fdbf3f01ce1b36fd1cec
7
- data.tar.gz: 2b66ea9433ccf5e35b54e22296b95a765dd9b249930e02c056d49afcc0c9f8a6731e7340db6db606fcbda33be7b4bc5d4f6fac53dc75dbae7e4a1b6991f634cc
6
+ metadata.gz: c138d27d24190e33af49618b03adbd2df9a2e3e72fc9b39ad7ad8e2ffefa47b6b73a17216221677732d7392b8b5998fb23b9b6ca8ba3f32f020372e63f924cf4
7
+ data.tar.gz: 36b38e8effcd0566ef0f6c4ed48d1d53d4da140a208673c3747e89a7afca32fd18f6a9405c2589f3b559ae91bf79f0e42e46ac276384a920a29f278c28d1a0a2
data/README.md CHANGED
@@ -25,8 +25,10 @@ a call to the database.
25
25
  ## Usage
26
26
 
27
27
  Store the current rate regularly by calling in a scheduled job (using something
28
- like `sidekiq-scheduler`, `whenever`, or `active_scheduler`) with the currencies
29
- you want to store:
28
+ like [sidekiq-scheduler](https://github.com/Moove-it/sidekiq-scheduler),
29
+ [whenever](https://github.com/javan/whenever),
30
+ or [active_scheduler](https://github.com/JustinAiken/active_scheduler))
31
+ with the currencies you want to store:
30
32
 
31
33
  ```rb
32
34
  ActiveCurrency::AddRates.call(%w[EUR USD])
@@ -130,8 +132,7 @@ Update `CHANGELOG.md`, update version in `lib/active_currency/version.rb`.
130
132
  Then:
131
133
 
132
134
  ```sh
133
- gem install bundler:1.3.0
134
- BUNDLE_GEMFILE=Gemfile-rails3.2 bundle update
135
+ gem install bundler:1.17.2
135
136
  BUNDLE_GEMFILE=Gemfile-rails4.2 bundle update
136
137
  BUNDLE_GEMFILE=Gemfile-rails5.2 bundle update
137
138
 
@@ -15,17 +15,12 @@ module ActiveCurrency
15
15
  to = Money::Currency.new(to)
16
16
  return 1 if from == to
17
17
 
18
- scope = date ? before(date) : all_scope
18
+ scope = date ? before(date) : all
19
19
  scope
20
20
  .where(from: from.iso_code, to: to.iso_code)
21
21
  .order(:created_at)
22
22
  .last
23
23
  &.value
24
24
  end
25
-
26
- # Scope retrocompatibility for Rails 3.2.
27
- def self.all_scope
28
- respond_to?(:scoped) ? scoped : all
29
- end
30
25
  end
31
26
  end
@@ -11,8 +11,15 @@ class CreateActiveCurrencyRates < ActiveCurrency::Migration
11
11
  t.datetime :created_at
12
12
  end
13
13
 
14
- add_index :active_currency_rates,
15
- %i[from to created_at],
16
- name: 'index_active_currency_rates'
14
+ reversible do |dir|
15
+ dir.up do
16
+ add_index :active_currency_rates,
17
+ %i[from to created_at],
18
+ name: 'index_active_currency_rates'
19
+ end
20
+ dir.down do
21
+ remove_index :active_currency_rates, 'index_active_currency_rates'
22
+ end
23
+ end
17
24
  end
18
25
  end
@@ -7,7 +7,7 @@ module ActiveCurrency
7
7
  initializer :append_migrations do |app|
8
8
  next if app.root.to_s.match(root.to_s)
9
9
 
10
- paths = ActiveRecord::Migrator.migrations_paths
10
+ paths = ActiveRecord::Tasks::DatabaseTasks.migrations_paths
11
11
  config.paths['db/migrate'].expanded.each do |path|
12
12
  paths << path
13
13
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module ActiveCurrency
4
- VERSION = '1.2.1'
4
+ VERSION = '1.3.0'
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: active_currency
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.2.1
4
+ version: 1.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Sunny Ripert
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-09-03 00:00:00.000000000 Z
11
+ date: 2021-04-29 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails
@@ -16,14 +16,14 @@ dependencies:
16
16
  requirements:
17
17
  - - ">="
18
18
  - !ruby/object:Gem::Version
19
- version: '3.2'
19
+ version: '4.2'
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
24
  - - ">="
25
25
  - !ruby/object:Gem::Version
26
- version: '3.2'
26
+ version: '4.2'
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: money-rails
29
29
  requirement: !ruby/object:Gem::Requirement