sinatra-activerecord 2.0.21 → 2.0.22
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/lib/sinatra/activerecord.rb +9 -2
- metadata +2 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: dd8c9b0af0329e3c58559409592d58ff44a7110407969effa9902c34c316eb07
|
|
4
|
+
data.tar.gz: fb39eecde9d4947aac413beda568cb3b60ad408d8505fddf45907cbed18193f2
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 8655fe10cab66ccb6d3c4ab505d81e7ae2d091057dcda13b2f8e0504f738274274a4ae4d53c5d6c91bf64f0c5b2be2603467bc62272d2cf7125e124c825b7c37
|
|
7
|
+
data.tar.gz: b04451e063eb7729b3e33937697c13f0d1dd329bfcd7970a8e2d0eda4f7c64fda3d72dc4aa896e16569db2d95a4f0ee158b7068147dac8d8ec53c545296c50d3
|
data/lib/sinatra/activerecord.rb
CHANGED
|
@@ -7,6 +7,8 @@ require 'pathname'
|
|
|
7
7
|
require 'yaml'
|
|
8
8
|
require 'erb'
|
|
9
9
|
|
|
10
|
+
require 'active_record/database_configurations/connection_url_resolver' if Gem.loaded_specs["activerecord"].version >= Gem::Version.create('6.1')
|
|
11
|
+
|
|
10
12
|
module Sinatra
|
|
11
13
|
module ActiveRecordHelper
|
|
12
14
|
def database
|
|
@@ -22,8 +24,13 @@ module Sinatra
|
|
|
22
24
|
file_path = File.join(root, path) if Pathname(path).relative? and root
|
|
23
25
|
file_spec = YAML.load(ERB.new(File.read(path)).result) || {}
|
|
24
26
|
|
|
25
|
-
|
|
26
|
-
|
|
27
|
+
# ActiveRecord 6.1+ has moved the connection url resolver to another module
|
|
28
|
+
if Gem.loaded_specs["activerecord"].version >= Gem::Version.create('6.1')
|
|
29
|
+
url_spec = ActiveRecord::DatabaseConfigurations::ConnectionUrlResolver.new(url).to_hash
|
|
30
|
+
else
|
|
31
|
+
url_spec = ActiveRecord::ConnectionAdapters::ConnectionSpecification::ConnectionUrlResolver.new(url).to_hash
|
|
32
|
+
end
|
|
33
|
+
|
|
27
34
|
# url_spec will override the same key, if exist
|
|
28
35
|
final_spec = file_spec.keys.map{ |env| [env, file_spec[env].merge(url_spec)] }.to_h
|
|
29
36
|
|
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.
|
|
4
|
+
version: 2.0.22
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Blake Mizerany
|
|
@@ -10,7 +10,7 @@ authors:
|
|
|
10
10
|
autorequire:
|
|
11
11
|
bindir: bin
|
|
12
12
|
cert_chain: []
|
|
13
|
-
date:
|
|
13
|
+
date: 2021-01-18 00:00:00.000000000 Z
|
|
14
14
|
dependencies:
|
|
15
15
|
- !ruby/object:Gem::Dependency
|
|
16
16
|
name: sinatra
|