Skip to content

Instantly share code, notes, and snippets.

@javierv
Created February 24, 2011 23:06
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save javierv/843084 to your computer and use it in GitHub Desktop.
Save javierv/843084 to your computer and use it in GitHub Desktop.
Fix for the test database in XapianDb
diff --git a/lib/xapian_db/railtie.rb b/lib/xapian_db/railtie.rb
index 9a9e3d8..926ea19 100644
--- a/lib/xapian_db/railtie.rb
+++ b/lib/xapian_db/railtie.rb
@@ -21,13 +21,13 @@ module XapianDb
if File.exist?(config_file_path)
db_config = YAML::load_file config_file_path
env_config = db_config[Rails.env]
- database_path = File.expand_path(env_config["database"]) || ":memory:"
+ database_path = env_config["database"] || ":memory:"
adapter = env_config["adapter"] || :active_record
writer = env_config["writer"] || :direct
beanstalk_daemon = env_config["beanstalk_daemon"]
else
# No config file, set the defaults
- Rails.env == "test" ? database_path = ":memory:" : database_path = File.expand_path("db/xapian_db/#{Rails.env}")
+ Rails.env == "test" ? database_path = ":memory:" : database_path = "db/xapian_db/#{Rails.env}"
adapter = :active_record
writer = :direct
beanstalk_daemon = nil
@@ -38,7 +38,7 @@ module XapianDb
if database_path == ":memory:"
config.database :memory
else
- config.database database_path
+ config.database File.expand_path(database_path)
end
config.adapter adapter.to_sym
config.writer writer.to_sym
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment