Skip to content
Browse files

change RAILS_ROOT to Rails.root

  • Loading branch information...
1 parent a016cde commit 0aef6dc67eb949612fe16ac2f8f6efddb13354fd @rlivsey rlivsey committed with jeroig Apr 8, 2011
Showing with 5 additions and 5 deletions.
  1. +2 −2 lib/escargot.rb
  2. +1 −1 rails/init.rb
  3. +2 −2 test/test_helper.rb
View
4 lib/escargot.rb
@@ -80,8 +80,8 @@ def self.search_count(query = "*", options = {}, call_by_instance_method = false
def self.register_all_models
models = []
# Search all Models in the application Rails
- Dir[File.join("#{RAILS_ROOT}/app/models".split(/\\/), "**", "*.rb")].each do |file|
- model = file.gsub(/#{RAILS_ROOT}\/app\/models\/(.*?)\.rb/,'\1').classify.constantize
+ Dir[File.join("#{Rails.root}/app/models".split(/\\/), "**", "*.rb")].each do |file|
+ model = file.gsub(/#{Rails.root}\/app\/models\/(.*?)\.rb/,'\1').classify.constantize
unless models.include?(model)
require file
end
View
2 rails/init.rb
@@ -16,6 +16,6 @@
Rails.logger.warn "No config/elastic_search.yaml file found, connecting to localhost:9200"
$elastic_search_client = ElasticSearch.new("localhost:9200")
else
- config = YAML.load_file(RAILS_ROOT + "/config/elasticsearch.yml")
+ config = YAML.load_file(Rails.root + "/config/elasticsearch.yml")
$elastic_search_client = ElasticSearch.new(config["host"] + ":" + config["port"].to_s, :timeout => 20)
end
View
4 test/test_helper.rb
@@ -4,10 +4,10 @@
require 'active_support/test_case'
ENV['RAILS_ENV'] = 'test'
-ENV['RAILS_ROOT'] ||= File.dirname(__FILE__) + '/../../../..'
+ENV['Rails.root'] ||= File.dirname(__FILE__) + '/../../../..'
require 'test/unit'
-require File.expand_path(File.join(ENV['RAILS_ROOT'], 'config/environment.rb'))
+require File.expand_path(File.join(ENV['Rails.root'], 'config/environment.rb'))
def load_schema
config = YAML::load(IO.read(File.dirname(__FILE__) + '/database.yml'))

0 comments on commit 0aef6dc

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