otr-activerecord 2.0.3 → 2.0.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/otr-activerecord/activerecord.rb +16 -1
- data/lib/otr-activerecord/version.rb +1 -1
- 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: c1e566ff7225406da58fdb74cf202e283bacf60486ab841aa45be19607efc54d
|
4
|
+
data.tar.gz: 3ee87d6850730d55c0aa64c71b5b68a17f3ab784f568377a164ea63df6b6ff3c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b5fb891ef5c65446dd662e89b401b77354257e571513d8ae9d9657a55fd24b3f4838d0d86e863d492537f8c5ea7f57ee97f6beaa3c5c6a9962af22e947af80ae
|
7
|
+
data.tar.gz: cbe9dc7f8ab23c2d475efd33915be5ff4f64b8672a6aba424d350b5bc1cf5d811af15955c6777acb4406b1b0e1aa73151bbf43432e7a54a149a4e7148aa6ce7f
|
@@ -58,7 +58,7 @@ module OTR
|
|
58
58
|
# Connect to database with a yml file. Example: "config/database.yml"
|
59
59
|
def self.configure_from_file!(path)
|
60
60
|
raise "#{path} does not exist!" unless File.file? path
|
61
|
-
result =(
|
61
|
+
result = load_yaml(path)
|
62
62
|
::ActiveRecord::Base.configurations = begin
|
63
63
|
result.each do |_env, config|
|
64
64
|
if config.all? { |_, v| v.is_a?(Hash) }
|
@@ -84,5 +84,20 @@ module OTR
|
|
84
84
|
def self.rack_env
|
85
85
|
(ENV['RACK_ENV'] || ENV['RAILS_ENV'] || ENV['APP_ENV'] || ENV['OTR_ENV'] || 'development').to_sym
|
86
86
|
end
|
87
|
+
|
88
|
+
# Support old Psych versions
|
89
|
+
def self.load_yaml(path)
|
90
|
+
erb_result = ERB.new(File.read(path)).result
|
91
|
+
|
92
|
+
result = if Gem::Version.new(Psych::VERSION) >= Gem::Version.new('3.1.0.pre1')
|
93
|
+
YAML.safe_load(erb_result, aliases: true)
|
94
|
+
else
|
95
|
+
YAML.safe_load(erb_result, [], [], true)
|
96
|
+
end
|
97
|
+
|
98
|
+
result || {}
|
99
|
+
end
|
100
|
+
|
101
|
+
private_class_method :load_yaml
|
87
102
|
end
|
88
103
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: otr-activerecord
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.0.
|
4
|
+
version: 2.0.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jordan Hollinger
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2022-01-20 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activerecord
|
@@ -68,7 +68,7 @@ homepage: https://github.com/jhollinger/otr-activerecord
|
|
68
68
|
licenses:
|
69
69
|
- MIT
|
70
70
|
metadata: {}
|
71
|
-
post_install_message:
|
71
|
+
post_install_message:
|
72
72
|
rdoc_options: []
|
73
73
|
require_paths:
|
74
74
|
- lib
|
@@ -83,8 +83,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
83
83
|
- !ruby/object:Gem::Version
|
84
84
|
version: '0'
|
85
85
|
requirements: []
|
86
|
-
rubygems_version: 3.1
|
87
|
-
signing_key:
|
86
|
+
rubygems_version: 3.0.3.1
|
87
|
+
signing_key:
|
88
88
|
specification_version: 4
|
89
89
|
summary: 'Off The Rails: Use ActiveRecord with Grape, Sinatra, Rack, or anything else!'
|
90
90
|
test_files: []
|