activerecord_url_connections 0.0.4 → 0.0.5

Sign up to get free protection for your applications and to get access to all the features.
@@ -13,6 +13,8 @@ module ActiveRecordURLConnections
13
13
  spec.reject!{ |key,value| value.nil? }
14
14
  spec.merge!(split_query_options(config.query))
15
15
  spec
16
+ rescue URI::InvalidURIError
17
+ return nil
16
18
  end
17
19
 
18
20
  private
@@ -27,11 +29,7 @@ ActiveRecord::Base.class_eval do
27
29
  alias_method :establish_connection_without_url, :establish_connection
28
30
  def establish_connection(spec = nil)
29
31
  spec ||= ENV["DATABASE_URL"]
30
- if spec.is_a?(String) && url = URI.parse(spec)
31
- spec = ActiveRecordURLConnections.parse(spec)
32
- end
33
- establish_connection_without_url(spec)
34
- rescue URI::InvalidURIError
32
+ spec = ActiveRecordURLConnections.parse(spec) if spec.is_a?(String)
35
33
  establish_connection_without_url(spec)
36
34
  end
37
35
  end
@@ -1,3 +1,3 @@
1
1
  module ActiveRecordURLConnections
2
- VERSION = "0.0.4"
2
+ VERSION = "0.0.5"
3
3
  end
metadata CHANGED
@@ -2,7 +2,7 @@
2
2
  name: activerecord_url_connections
3
3
  version: !ruby/object:Gem::Version
4
4
  prerelease:
5
- version: 0.0.4
5
+ version: 0.0.5
6
6
  platform: ruby
7
7
  authors:
8
8
  - Glenn Gillen