sinatra-activerecord 2.0.23 → 2.0.24
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/README.md +4 -0
- data/lib/sinatra/activerecord.rb +6 -2
- metadata +6 -6
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 915ee68564f8c6e934250b72f2953da682a4f83093e6ec2faaa69c2f646fe753
|
|
4
|
+
data.tar.gz: e53038e87fd52df06156caf21fdfb3d9dc60ddf9de91abc3e79a5c431655237c
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: ca0a40e61bded7ea250e26c44004e6ec22ca8849efa4a4349acc0ff8cc9d1364dfe6d9c36484a52a2c306fbe039dfc32321b0434c4afe78436b1958a74957e57
|
|
7
|
+
data.tar.gz: 9d3f855a19210f1e72b674f41c3d686b837bd722d1393a86a688752da00b493c49f7ad81e68f91ef8fcdb91e25163c307aaa4a7859c3b3f126f740ed9cd6e638
|
data/README.md
CHANGED
|
@@ -37,6 +37,10 @@ will automatically be read as the database (if you haven't specified otherwise).
|
|
|
37
37
|
|
|
38
38
|
If both `config/database.yml` and `$DATABASE_URL` are present, the database configuration of this two will be merged, with $DATABASE_URL's variable taking precedence over database.yml (for the same variable / key).
|
|
39
39
|
|
|
40
|
+
|
|
41
|
+
Note: If you are using ActiveRecord 6.0 and above, and have [defined multiple databases](https://guides.rubyonrails.org/active_record_multiple_databases.html#setting-up-your-application) for the database.yml, the $DATABASE_URL configuration will be discarded, following [Active Record convention here](https://github.com/rails/rails/blob/main/activerecord/lib/active_record/database_configurations.rb#L169).
|
|
42
|
+
|
|
43
|
+
|
|
40
44
|
Note that in **modular** Sinatra applications you will need to first register
|
|
41
45
|
the extension:
|
|
42
46
|
|
data/lib/sinatra/activerecord.rb
CHANGED
|
@@ -22,7 +22,9 @@ module Sinatra
|
|
|
22
22
|
path = "#{Dir.pwd}/config/database.yml"
|
|
23
23
|
url = ENV['DATABASE_URL']
|
|
24
24
|
file_path = File.join(root, path) if Pathname(path).relative? and root
|
|
25
|
-
|
|
25
|
+
source = ERB.new(File.read(path)).result
|
|
26
|
+
file_spec = YAML.respond_to?(:unsafe_load) ? YAML.unsafe_load(source) : YAML.load(source)
|
|
27
|
+
file_spec ||= {}
|
|
26
28
|
|
|
27
29
|
# ActiveRecord 6.1+ has moved the connection url resolver to another module
|
|
28
30
|
if Gem.loaded_specs["activerecord"].version >= Gem::Version.create('6.1')
|
|
@@ -64,7 +66,9 @@ module Sinatra
|
|
|
64
66
|
|
|
65
67
|
def database_file=(path)
|
|
66
68
|
path = File.join(root, path) if Pathname(path).relative? and root
|
|
67
|
-
|
|
69
|
+
source = ERB.new(File.read(path)).result
|
|
70
|
+
spec = YAML.respond_to?(:unsafe_load) ? YAML.unsafe_load(source) : YAML.load(source)
|
|
71
|
+
spec ||= {}
|
|
68
72
|
set :database, spec
|
|
69
73
|
end
|
|
70
74
|
|
metadata
CHANGED
|
@@ -1,16 +1,16 @@
|
|
|
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.24
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Blake Mizerany
|
|
8
8
|
- Janko Marohnić
|
|
9
9
|
- Axel Kee
|
|
10
|
-
autorequire:
|
|
10
|
+
autorequire:
|
|
11
11
|
bindir: bin
|
|
12
12
|
cert_chain: []
|
|
13
|
-
date: 2021-
|
|
13
|
+
date: 2021-12-26 00:00:00.000000000 Z
|
|
14
14
|
dependencies:
|
|
15
15
|
- !ruby/object:Gem::Dependency
|
|
16
16
|
name: sinatra
|
|
@@ -115,7 +115,7 @@ homepage: http://github.com/sinatra-activerecord/sinatra-activerecord
|
|
|
115
115
|
licenses:
|
|
116
116
|
- MIT
|
|
117
117
|
metadata: {}
|
|
118
|
-
post_install_message:
|
|
118
|
+
post_install_message:
|
|
119
119
|
rdoc_options: []
|
|
120
120
|
require_paths:
|
|
121
121
|
- lib
|
|
@@ -130,8 +130,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
130
130
|
- !ruby/object:Gem::Version
|
|
131
131
|
version: '0'
|
|
132
132
|
requirements: []
|
|
133
|
-
rubygems_version: 3.1.
|
|
134
|
-
signing_key:
|
|
133
|
+
rubygems_version: 3.1.6
|
|
134
|
+
signing_key:
|
|
135
135
|
specification_version: 4
|
|
136
136
|
summary: Extends Sinatra with ActiveRecord helpers.
|
|
137
137
|
test_files: []
|