diff options
author | Aaron Patterson <aaron.patterson@gmail.com> | 2010-07-08 11:50:07 -0700 |
---|---|---|
committer | Jeremy Kemper <jeremy@bitsweat.net> | 2010-07-08 11:52:38 -0700 |
commit | 7b0f8534c7a806fd04aac7c817c247433d02f641 (patch) | |
tree | b40415e890ef4da0c151058f46ecc4a90c7cd37e /activerecord/lib | |
parent | 9ac9c35117a8f232d6df9009b8c55f4ed2ce077b (diff) | |
download | rails-7b0f8534c7a806fd04aac7c817c247433d02f641.tar.gz rails-7b0f8534c7a806fd04aac7c817c247433d02f641.tar.bz2 rails-7b0f8534c7a806fd04aac7c817c247433d02f641.zip |
moving parse_sqlite_config to the sqlite3_connection method (where it belongs) [#5071 state:resolved]
Signed-off-by: Jeremy Kemper <jeremy@bitsweat.net>
Diffstat (limited to 'activerecord/lib')
-rw-r--r-- | activerecord/lib/active_record/connection_adapters/sqlite3_adapter.rb | 12 | ||||
-rw-r--r-- | activerecord/lib/active_record/connection_adapters/sqlite_adapter.rb | 19 |
2 files changed, 11 insertions, 20 deletions
diff --git a/activerecord/lib/active_record/connection_adapters/sqlite3_adapter.rb b/activerecord/lib/active_record/connection_adapters/sqlite3_adapter.rb index e4fa412a67..e5e92f2b1c 100644 --- a/activerecord/lib/active_record/connection_adapters/sqlite3_adapter.rb +++ b/activerecord/lib/active_record/connection_adapters/sqlite3_adapter.rb @@ -4,7 +4,17 @@ module ActiveRecord class Base # sqlite3 adapter reuses sqlite_connection. def self.sqlite3_connection(config) # :nodoc: - parse_sqlite_config!(config) + # Require database. + unless config[:database] + raise ArgumentError, "No database file specified. Missing argument: database" + end + + # Allow database path relative to Rails.root, but only if + # the database path is not the special path that tells + # Sqlite to build a database only in memory. + if defined?(Rails.root) && ':memory:' != config[:database] + config[:database] = File.expand_path(config[:database], Rails.root) + end unless 'sqlite3' == config[:adapter] raise ArgumentError, 'adapter name should be "sqlite3"' diff --git a/activerecord/lib/active_record/connection_adapters/sqlite_adapter.rb b/activerecord/lib/active_record/connection_adapters/sqlite_adapter.rb index 1927585c49..117cf447df 100644 --- a/activerecord/lib/active_record/connection_adapters/sqlite_adapter.rb +++ b/activerecord/lib/active_record/connection_adapters/sqlite_adapter.rb @@ -2,25 +2,6 @@ require 'active_record/connection_adapters/abstract_adapter' require 'active_support/core_ext/kernel/requires' module ActiveRecord - class Base - class << self - private - def parse_sqlite_config!(config) - # Require database. - unless config[:database] - raise ArgumentError, "No database file specified. Missing argument: database" - end - - # Allow database path relative to Rails.root, but only if - # the database path is not the special path that tells - # Sqlite to build a database only in memory. - if defined?(Rails.root) && ':memory:' != config[:database] - config[:database] = File.expand_path(config[:database], Rails.root) - end - end - end - end - module ConnectionAdapters #:nodoc: class SQLiteColumn < Column #:nodoc: class << self |