diff options
author | Pratik Naik <pratiknaik@gmail.com> | 2009-08-09 01:53:50 +0100 |
---|---|---|
committer | Pratik Naik <pratiknaik@gmail.com> | 2009-08-09 01:54:08 +0100 |
commit | 89c8affe475d14f6dbe74b5e75a2613e047d01fc (patch) | |
tree | c822a106e782cfe62e44eb459a55eafa9e778c32 /railties/lib/tasks | |
parent | 071f48b716ce2cd8a46219730afc307c258a9798 (diff) | |
download | rails-89c8affe475d14f6dbe74b5e75a2613e047d01fc.tar.gz rails-89c8affe475d14f6dbe74b5e75a2613e047d01fc.tar.bz2 rails-89c8affe475d14f6dbe74b5e75a2613e047d01fc.zip |
Use Pathname for checking if sqlite path is absolute
Diffstat (limited to 'railties/lib/tasks')
-rw-r--r-- | railties/lib/tasks/databases.rake | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/railties/lib/tasks/databases.rake b/railties/lib/tasks/databases.rake index 93aec674ab..b82341ba94 100644 --- a/railties/lib/tasks/databases.rake +++ b/railties/lib/tasks/databases.rake @@ -440,7 +440,11 @@ def drop_database(config) ActiveRecord::Base.establish_connection(config) ActiveRecord::Base.connection.drop_database config['database'] when /^sqlite/ - FileUtils.rm((config['database'] =~ /^\// ? config['database'] : File.join(RAILS_ROOT, config['database']))) + require 'pathname' + path = Pathname.new(config['database']) + file = path.absolute? ? path.to_s : File.join(RAILS_ROOT, path) + + FileUtils.rm(file) when 'postgresql' ActiveRecord::Base.establish_connection(config.merge('database' => 'postgres', 'schema_search_path' => 'public')) ActiveRecord::Base.connection.drop_database config['database'] |