lib/elasticsearch_autocomplete.rb in elasticsearch_autocomplete-0.1.2 vs lib/elasticsearch_autocomplete.rb in elasticsearch_autocomplete-0.1.3
- old
+ new
@@ -1,14 +1,15 @@
+require 'tire'
require 'elasticsearch_autocomplete/version'
require 'elasticsearch_autocomplete/analyzers'
require 'elasticsearch_autocomplete/model_addition'
-require 'elasticsearch_autocomplete/railtie' if defined? Rails
+require 'elasticsearch_autocomplete/railtie' if Object.const_defined?(:Rails)
module ElasticsearchAutocomplete
mattr_accessor :defaults
def self.default_index_prefix
- Rails.application.class.name.split('::').first.downcase if Object.const_defined?('Rails')
+ Object.const_defined?(:Rails) ? ::Rails.application.class.name.split('::').first.downcase : nil
end
self.defaults = {:attr => :name, :localized => false, :mode => :word, :index_prefix => default_index_prefix}
MODES = {