sinatra-activerecord 2.0.17 → 2.0.18

Sign up to get free protection for your applications and to get access to all the features.
Files changed (3) hide show
  1. checksums.yaml +4 -4
  2. data/lib/sinatra/activerecord.rb +12 -4
  3. metadata +2 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: a97567854628642b73c97356482c4339283aed960de12973456174ae0647fd11
4
- data.tar.gz: cdedb76e50ecc962431c6e51a8fdda4dad0cfe352f03b3da803f334db7a72875
3
+ metadata.gz: fc810f00cad9c2ea25e192e3561b105d86b59470b74f1ed87989956516582a07
4
+ data.tar.gz: 6ed1bf13fb1bf569ecd6f13c2e30e733f46f479b78b09202dba084498c7f0788
5
5
  SHA512:
6
- metadata.gz: 95afe1d57ab23c9f83667cc8a173aadb86e7751019a1bd67327b960e8c1ea829dd66617addd29caec86ff1e66667e1c78a94c5455a31241d245e8e33776887a8
7
- data.tar.gz: 6616b14f3ae6a53c10bca15b25f749d7bf3913070ce7e31db916b773f32d60b1014716e12b34f3dddc530a52c0904c52582c5c28e52c10712418d3bd71a140f7
6
+ metadata.gz: '090c13e2217b2ca868a6224422211a4c22ae95f7a6d2b36819714e0f866153cc05f05b9b6d557a99e3aa1ab69a4c3f62dc57022d9c1c0439c3d07d0cb6474a9b'
7
+ data.tar.gz: dc906d8a9fcbc2118f743aaba8c1a19ac0816ed7b5353d0a21fe7308a4e500fbe09ef328d640555600ce5f93ffcb4a2ebfd9890d9e983a520c9c52596a117138
@@ -43,13 +43,21 @@ module Sinatra
43
43
  if spec.is_a?(Hash) and spec.symbolize_keys[environment.to_sym]
44
44
  ActiveRecord::Base.configurations = spec.stringify_keys
45
45
  ActiveRecord::Base.establish_connection(environment.to_sym)
46
- elsif spec.is_a?(Hash)
47
- ActiveRecord::Base.configurations[environment.to_s] = spec.stringify_keys
46
+ elsif spec.is_a?(Hash)
47
+ ActiveRecord::Base.configurations = {
48
+ environment.to_s => spec.stringify_keys
49
+ }
50
+
48
51
  ActiveRecord::Base.establish_connection(spec.stringify_keys)
49
52
  else
53
+ if Gem.loaded_specs["activerecord"].version >= Gem::Version.create('6.0')
54
+ ActiveRecord::Base.configurations ||= ActiveRecord::DatabaseConfigurations.new({}).resolve(spec)
55
+ else
56
+ ActiveRecord::Base.configurations ||= {}
57
+ ActiveRecord::Base.configurations[environment.to_s] = ActiveRecord::ConnectionAdapters::ConnectionSpecification::ConnectionUrlResolver.new(spec).to_hash
58
+ end
59
+
50
60
  ActiveRecord::Base.establish_connection(spec)
51
- ActiveRecord::Base.configurations ||= {}
52
- ActiveRecord::Base.configurations[environment.to_s] = ActiveRecord::ConnectionAdapters::ConnectionSpecification::ConnectionUrlResolver.new(spec).to_hash
53
61
  end
54
62
  end
55
63
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sinatra-activerecord
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.0.17
4
+ version: 2.0.18
5
5
  platform: ruby
6
6
  authors:
7
7
  - Blake Mizerany
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2020-04-15 00:00:00.000000000 Z
12
+ date: 2020-04-16 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: sinatra