otr-activerecord 1.2.4 → 1.2.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/lib/otr-activerecord/activerecord.rb +11 -2
- data/lib/otr-activerecord/version.rb +1 -1
- data/lib/otr-activerecord.rb +0 -2
- metadata +4 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 7c62e1c1f9dbdcd4285f92e2f3c10f2bf8e56d4a721437ba6973a7f3766f608c
|
4
|
+
data.tar.gz: 84d8aa3b44516b9b6303452b1d6741f31646da1b7e9fa1c08f2b85a6d5bbb80f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8f8cbe209d5cc955054933c40505f3a6dab0ca69d24ba526a816fad8f1ecb1dd55cb5715270ae8841b8d26d48473bba5f37ca22bfb109ce2122c020385a3075a
|
7
|
+
data.tar.gz: '09c8dab63a46a38348a2ce94d531b7ba410f2a4c4f69a3a795560b1b23f8c33040138b7e594a4a630af680173bd1661d85bd41981ac6ad7c14c5ff619acf7365'
|
@@ -4,6 +4,9 @@ require 'erb'
|
|
4
4
|
module OTR
|
5
5
|
# ActiveRecord configuration module
|
6
6
|
module ActiveRecord
|
7
|
+
autoload :Compatibility4, 'otr-activerecord/compatibility_4'
|
8
|
+
autoload :Compatibility5, 'otr-activerecord/compatibility_5'
|
9
|
+
|
7
10
|
class << self
|
8
11
|
# Relative path to the "db" dir
|
9
12
|
attr_accessor :db_dir
|
@@ -20,7 +23,8 @@ module OTR
|
|
20
23
|
# Connect to database with a Hash. Example:
|
21
24
|
# {adapter: 'postgresql', host: 'localhost', database: 'db', username: 'user', password: 'pass', encoding: 'utf8', pool: 10, timeout: 5000}
|
22
25
|
def self.configure_from_hash!(spec)
|
23
|
-
|
26
|
+
config = spec.stringify_keys.merge("migrations_paths" => ::OTR::ActiveRecord.migrations_paths)
|
27
|
+
::ActiveRecord::Base.configurations = {rack_env.to_s => config}
|
24
28
|
::ActiveRecord::Base.establish_connection(rack_env)
|
25
29
|
end
|
26
30
|
|
@@ -32,7 +36,12 @@ module OTR
|
|
32
36
|
# Connect to database with a yml file. Example: "config/database.yml"
|
33
37
|
def self.configure_from_file!(path)
|
34
38
|
raise "#{path} does not exist!" unless File.file? path
|
35
|
-
::ActiveRecord::Base.configurations =
|
39
|
+
::ActiveRecord::Base.configurations =
|
40
|
+
(YAML.load(ERB.new(File.read(path)).result) || {}).
|
41
|
+
reduce({}) { |a, (env, config)|
|
42
|
+
a[env] = {"migrations_paths" => ::OTR::ActiveRecord.migrations_paths}.merge config
|
43
|
+
a
|
44
|
+
}
|
36
45
|
::ActiveRecord::Base.establish_connection(rack_env)
|
37
46
|
end
|
38
47
|
|
data/lib/otr-activerecord.rb
CHANGED
@@ -2,7 +2,5 @@ require 'active_record'
|
|
2
2
|
require 'hashie-forbidden_attributes'
|
3
3
|
require 'otr-activerecord/version'
|
4
4
|
require 'otr-activerecord/activerecord'
|
5
|
-
require 'otr-activerecord/compatibility_4'
|
6
|
-
require 'otr-activerecord/compatibility_5'
|
7
5
|
require 'otr-activerecord/middleware/connection_management.rb'
|
8
6
|
require 'otr-activerecord/defaults'
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: otr-activerecord
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.2.
|
4
|
+
version: 1.2.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jordan Hollinger
|
@@ -19,7 +19,7 @@ dependencies:
|
|
19
19
|
version: '4.0'
|
20
20
|
- - "<"
|
21
21
|
- !ruby/object:Gem::Version
|
22
|
-
version: '5.
|
22
|
+
version: '5.3'
|
23
23
|
type: :runtime
|
24
24
|
prerelease: false
|
25
25
|
version_requirements: !ruby/object:Gem::Requirement
|
@@ -29,7 +29,7 @@ dependencies:
|
|
29
29
|
version: '4.0'
|
30
30
|
- - "<"
|
31
31
|
- !ruby/object:Gem::Version
|
32
|
-
version: '5.
|
32
|
+
version: '5.3'
|
33
33
|
- !ruby/object:Gem::Dependency
|
34
34
|
name: hashie-forbidden_attributes
|
35
35
|
requirement: !ruby/object:Gem::Requirement
|
@@ -81,7 +81,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
81
81
|
version: '0'
|
82
82
|
requirements: []
|
83
83
|
rubyforge_project:
|
84
|
-
rubygems_version: 2.
|
84
|
+
rubygems_version: 2.7.3
|
85
85
|
signing_key:
|
86
86
|
specification_version: 4
|
87
87
|
summary: 'Off The Rails: Use ActiveRecord with Grape, Sinatra, Rack, or anything else!'
|