sinatra-activerecord 2.0.22 → 2.0.23
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 +12 -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: c1985ef88a83eccdcf4ad4db78ced061a9398fd54cd01a0444816f4b83c661da
|
|
4
|
+
data.tar.gz: e449fdc9807e75b4d9994545d08107473b618712b870b37edfb5d84de317aef3
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: b6e0d9905eb59b73e06cb57d9e69f1351c34ffa17a386bac9bc4a520fd9950d28cb5c58d68e09dcb261a9550ed8a58194f72257f466e793c540f664fc0edc945
|
|
7
|
+
data.tar.gz: 60ff2c30ffb5b65b6cb6f9d4a9b9d0aaf39af210ff7c3fcea6a04365b9573b67864d3d4b9331e6193986b499ba6c06ea4d512173114a183442f8a6d30d0e9bea
|
data/lib/sinatra/activerecord.rb
CHANGED
|
@@ -31,8 +31,18 @@ module Sinatra
|
|
|
31
31
|
url_spec = ActiveRecord::ConnectionAdapters::ConnectionSpecification::ConnectionUrlResolver.new(url).to_hash
|
|
32
32
|
end
|
|
33
33
|
|
|
34
|
-
# url_spec will override the same key
|
|
35
|
-
|
|
34
|
+
# if the configuration concerns only one database, and url_spec exist, url_spec will override the same key
|
|
35
|
+
# if the configuration has multiple databases (Rails 6.0+ feature), url_spec is discarded
|
|
36
|
+
# Following Active Record config convention
|
|
37
|
+
# https://github.com/rails/rails/blob/main/activerecord/lib/active_record/database_configurations.rb#L169
|
|
38
|
+
final_spec = file_spec.keys.map do |env|
|
|
39
|
+
config = file_spec[env]
|
|
40
|
+
if config.is_a?(Hash) && config.all? { |_k, v| v.is_a?(Hash) }
|
|
41
|
+
[env, config]
|
|
42
|
+
else
|
|
43
|
+
[env, config.merge(url_spec)]
|
|
44
|
+
end
|
|
45
|
+
end.to_h
|
|
36
46
|
|
|
37
47
|
app.set :database, final_spec
|
|
38
48
|
elsif ENV['DATABASE_URL']
|
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.23
|
|
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: 2021-
|
|
13
|
+
date: 2021-05-12 00:00:00.000000000 Z
|
|
14
14
|
dependencies:
|
|
15
15
|
- !ruby/object:Gem::Dependency
|
|
16
16
|
name: sinatra
|