diff options
author | David Heinemeier Hansson <david@loudthinking.com> | 2014-08-07 16:10:20 -0700 |
---|---|---|
committer | David Heinemeier Hansson <david@loudthinking.com> | 2014-08-07 16:10:20 -0700 |
commit | 089661b69ad055cab68ea860c085c7f852da3972 (patch) | |
tree | a39fe35f3c399b199bdca8490724b451761a1cba /activerecord/lib/active_record/connection_adapters | |
parent | cc1de71bfaced172fe00a66fd381da69d9528e8b (diff) | |
parent | e81453ef92b37156dafc092093106c8e8b87b268 (diff) | |
download | rails-089661b69ad055cab68ea860c085c7f852da3972.tar.gz rails-089661b69ad055cab68ea860c085c7f852da3972.tar.bz2 rails-089661b69ad055cab68ea860c085c7f852da3972.zip |
Merge branch 'master' of github.com:rails/rails
Diffstat (limited to 'activerecord/lib/active_record/connection_adapters')
-rw-r--r-- | activerecord/lib/active_record/connection_adapters/connection_specification.rb | 2 | ||||
-rw-r--r-- | activerecord/lib/active_record/connection_adapters/schema_cache.rb | 7 |
2 files changed, 8 insertions, 1 deletions
diff --git a/activerecord/lib/active_record/connection_adapters/connection_specification.rb b/activerecord/lib/active_record/connection_adapters/connection_specification.rb index 5693031053..d28a54b8f9 100644 --- a/activerecord/lib/active_record/connection_adapters/connection_specification.rb +++ b/activerecord/lib/active_record/connection_adapters/connection_specification.rb @@ -32,7 +32,7 @@ module ActiveRecord # } def initialize(url) raise "Database URL cannot be empty" if url.blank? - @uri = URI.parse(url) + @uri = uri_parser.parse(url) @adapter = @uri.scheme.gsub('-', '_') @adapter = "postgresql" if @adapter == "postgres" diff --git a/activerecord/lib/active_record/connection_adapters/schema_cache.rb b/activerecord/lib/active_record/connection_adapters/schema_cache.rb index 3116bed596..a10ce330c7 100644 --- a/activerecord/lib/active_record/connection_adapters/schema_cache.rb +++ b/activerecord/lib/active_record/connection_adapters/schema_cache.rb @@ -19,6 +19,7 @@ module ActiveRecord # A cached lookup for table existence. def table_exists?(name) + prepare_tables if @tables.empty? return @tables[name] if @tables.key? name @tables[name] = connection.table_exists?(name) @@ -82,6 +83,12 @@ module ActiveRecord def marshal_load(array) @version, @columns, @columns_hash, @primary_keys, @tables = array end + + private + + def prepare_tables + connection.tables.each { |table| @tables[table] = true } + end end end end |