sinatra-activerecord 2.0.23 → 2.0.24

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: c1985ef88a83eccdcf4ad4db78ced061a9398fd54cd01a0444816f4b83c661da
4
- data.tar.gz: e449fdc9807e75b4d9994545d08107473b618712b870b37edfb5d84de317aef3
3
+ metadata.gz: 915ee68564f8c6e934250b72f2953da682a4f83093e6ec2faaa69c2f646fe753
4
+ data.tar.gz: e53038e87fd52df06156caf21fdfb3d9dc60ddf9de91abc3e79a5c431655237c
5
5
  SHA512:
6
- metadata.gz: b6e0d9905eb59b73e06cb57d9e69f1351c34ffa17a386bac9bc4a520fd9950d28cb5c58d68e09dcb261a9550ed8a58194f72257f466e793c540f664fc0edc945
7
- data.tar.gz: 60ff2c30ffb5b65b6cb6f9d4a9b9d0aaf39af210ff7c3fcea6a04365b9573b67864d3d4b9331e6193986b499ba6c06ea4d512173114a183442f8a6d30d0e9bea
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
 
@@ -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
- file_spec = YAML.load(ERB.new(File.read(path)).result) || {}
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
- spec = YAML.load(ERB.new(File.read(path)).result) || {}
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.23
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-05-12 00:00:00.000000000 Z
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.2
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: []