Skip to content
This repository
Browse code

Use Pathname for checking if sqlite path is absolute

  • Loading branch information...
commit 89c8affe475d14f6dbe74b5e75a2613e047d01fc 1 parent 071f48b
Pratik authored August 09, 2009

Showing 1 changed file with 5 additions and 1 deletion. Show diff stats Hide diff stats

  1. 6  railties/lib/tasks/databases.rake
6  railties/lib/tasks/databases.rake
@@ -440,7 +440,11 @@ def drop_database(config)
440 440
     ActiveRecord::Base.establish_connection(config)
441 441
     ActiveRecord::Base.connection.drop_database config['database']
442 442
   when /^sqlite/
443  
-    FileUtils.rm((config['database'] =~ /^\// ? config['database'] : File.join(RAILS_ROOT, config['database'])))
  443
+    require 'pathname'
  444
+    path = Pathname.new(config['database'])
  445
+    file = path.absolute? ? path.to_s : File.join(RAILS_ROOT, path)
  446
+
  447
+    FileUtils.rm(file)
444 448
   when 'postgresql'
445 449
     ActiveRecord::Base.establish_connection(config.merge('database' => 'postgres', 'schema_search_path' => 'public'))
446 450
     ActiveRecord::Base.connection.drop_database config['database']

0 notes on commit 89c8aff

Please sign in to comment.
Something went wrong with that request. Please try again.