diff options
author | David Heinemeier Hansson <david@loudthinking.com> | 2004-12-01 11:26:47 +0000 |
---|---|---|
committer | David Heinemeier Hansson <david@loudthinking.com> | 2004-12-01 11:26:47 +0000 |
commit | bc80460115b534687a5311b03e8fd1ea06746419 (patch) | |
tree | 2800adf95928bf512aa5976a7931046c7d0e1078 | |
parent | d6d875bfb4103b6ac777083946bdcfa527d750a8 (diff) | |
download | rails-bc80460115b534687a5311b03e8fd1ea06746419.tar.gz rails-bc80460115b534687a5311b03e8fd1ea06746419.tar.bz2 rails-bc80460115b534687a5311b03e8fd1ea06746419.zip |
Added relative path search for sqlite dbfiles in database.yml (if RAILS_ROOT is defined) #233 [bitsweat]
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@34 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
-rw-r--r-- | activerecord/CHANGELOG | 2 | ||||
-rw-r--r-- | activerecord/lib/active_record/connection_adapters/sqlite_adapter.rb | 5 |
2 files changed, 5 insertions, 2 deletions
diff --git a/activerecord/CHANGELOG b/activerecord/CHANGELOG index fdc127dff2..c7fc7aaf54 100644 --- a/activerecord/CHANGELOG +++ b/activerecord/CHANGELOG @@ -1,5 +1,7 @@ *CVS* +* Added relative path search for sqlite dbfiles in database.yml (if RAILS_ROOT is defined) #233 [bitsweat] + * Added option to establish_connection where you'll be able to leave out the parameter to have it use the RAILS_ENV environment variable * Added ADO-based SQLServerAdapter (only works on Windows) [Joey Gibson] diff --git a/activerecord/lib/active_record/connection_adapters/sqlite_adapter.rb b/activerecord/lib/active_record/connection_adapters/sqlite_adapter.rb index 1f3845e6a8..afe545b313 100644 --- a/activerecord/lib/active_record/connection_adapters/sqlite_adapter.rb +++ b/activerecord/lib/active_record/connection_adapters/sqlite_adapter.rb @@ -12,7 +12,8 @@ module ActiveRecord unless config.has_key?(:dbfile) raise ArgumentError, "No database file specified. Missing argument: dbfile" end - + + config[:dbfile] = File.join(RAILS_ROOT, config[:dbfile]) if config[:dbfile] =~ /^\w/ && Object.const_defined?(:RAILS_ROOT) db = SQLite::Database.new(config[:dbfile], 0) db.show_datatypes = "ON" if !defined? SQLite::Version @@ -102,4 +103,4 @@ module ActiveRecord end end end -end
\ No newline at end of file +end |