Class: ActsAsSolr::Deprecation

Inherits:
Object
  • Object
show all
Defined in:
lib/acts_as_solr/deprecation.rb

Class Method Summary collapse

Class Method Details

.plog(text) ⇒ Object

This will print the text to stdout and log the text if rails logger is available



55
56
57
58
# File 'lib/acts_as_solr/deprecation.rb', line 55

def self.plog text
  puts text
  RAILS_DEFAULT_LOGGER.warn text if defined? RAILS_DEFAULT_LOGGER
end

.validate_index(options = {}) ⇒ Object

Validates the options passed during indexing



46
47
48
49
50
51
# File 'lib/acts_as_solr/deprecation.rb', line 46

def self.validate_index options={}
  if options[:background]
    plog "The :background option is being deprecated. There are better and more efficient " +
         "ways to handle delayed saving of your records."
  end
end

.validate_query(options = {}) ⇒ Object

Validates the options passed during query



26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
# File 'lib/acts_as_solr/deprecation.rb', line 26

def self.validate_query options={}
  if options[:field_types]
    plog "The option :field_types for searching is deprecated. " +
         "The field types are automatically traced back when you specify a field type in your model."
  end
  if options[:sort_by]
    plog "The option :sort_by is deprecated, use :order instead!"
    options[:order] ||= options[:sort_by]
  end
  if options[:start]
    plog "The option :start is deprecated, use :offset instead!"
    options[:offset] ||= options[:start]
  end
  if options[:rows]
    plog "The option :rows is deprecated, use :limit instead!"
    options[:limit] ||= options[:rows]
  end
end