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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
- SHA1:
3
- metadata.gz: 79889ffb8019c357312f6fabb6e8d2e9841c0d7d
4
- data.tar.gz: d359105a7837c047c4fa2107efec5ec930181747
2
+ SHA256:
3
+ metadata.gz: 7c62e1c1f9dbdcd4285f92e2f3c10f2bf8e56d4a721437ba6973a7f3766f608c
4
+ data.tar.gz: 84d8aa3b44516b9b6303452b1d6741f31646da1b7e9fa1c08f2b85a6d5bbb80f
5
5
  SHA512:
6
- metadata.gz: 18c3b4782514bc052be4fd61d42d38874db80852ff3a50ea363be3fd5bcffa5e9f80d9e27b010a5dfa503dc38301a0bfff059777af580ce0940aa60e53839e83
7
- data.tar.gz: 7591dff71f30c8fe328f9eda40b439f71e8cd5166be062c1f5b659786d645c151a4838852fb0af36afa8fda28b1c03abe07b891d790ce15055f2a6c2c440973c
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
- ::ActiveRecord::Base.configurations = {rack_env.to_s => spec.stringify_keys}
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 = YAML.load(ERB.new(File.read(path)).result) || {}
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
 
@@ -1,6 +1,6 @@
1
1
  module OTR
2
2
  module ActiveRecord
3
3
  # Gem version
4
- VERSION = '1.2.4'
4
+ VERSION = '1.2.5'
5
5
  end
6
6
  end
@@ -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
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.2'
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.2'
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.5.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!'