options for the find
# File lib/sunspot/rails/adapters.rb, line 27 def initialize(clazz) super(clazz) @inherited_attributes = [:include, :select, :scopes] end
Get one ActiveRecord instance out of the database by ID
Database ID of model to retreive
ActiveRecord model
# File lib/sunspot/rails/adapters.rb, line 56 def load(id) @clazz.where(@clazz.primary_key => id).merge(scope_for_load).first end
Get a collection of ActiveRecord instances out of the database by ID
Database IDs of models to retrieve
Collection of ActiveRecord models
# File lib/sunspot/rails/adapters.rb, line 71 def load_all(ids) @clazz.where(@clazz.primary_key => ids).merge(scope_for_load) end
Set the fields to select from the database. This will be passed to ActiveRecord.
String of comma-separated columns or array of columns
# File lib/sunspot/rails/adapters.rb, line 40 def select=(value) value = value.join(', ') if value.respond_to?(:join) @select = value end