Class: Suggester::Handlers::ActiveRecord

Inherits:
Base
  • Object
show all
Defined in:
lib/suggester/handlers/active_record.rb

Instance Attribute Summary

Attributes inherited from Base

#unique_field_name

Instance Method Summary collapse

Methods inherited from Base

#cache, #find, #match

Methods included from Helpers::Refresh

#force_refresh!, #last_refreshed_at, #needs_refresh?, #refresh!, #refresh_interval, #refresh_interval=

Constructor Details

#initialize(params = {}) ⇒ ActiveRecord

Returns a new instance of ActiveRecord.



7
8
9
10
11
12
13
14
15
# File 'lib/suggester/handlers/active_record.rb', line 7

def initialize(params = {})
  @klass      = params[:class]      || raise("must specify a class")
  @klass = @klass.constantize if @klass.is_a?(String)
  @id_field   = params[:id_field]   || :id
  @name_field = params[:name_field] || :name
  @conditions = params[:conditions] || {}
  @include    = params[:include]   || {}
  super(params)
end