Sha256: 59a316926b9f7696869d725a60586dee64df92d2260b68a45dd3f2fdff5086b8
Contents?: true
Size: 724 Bytes
Versions: 5
Compression:
Stored size: 724 Bytes
Contents
require File.join(File.dirname(__FILE__), 'content') module MockAdapter class InstanceAdapter < Sunspot::Adapters::InstanceAdapter def id @instance.id end end class DataAccessor < Sunspot::Adapters::DataAccessor def load(id) @clazz.get(id.to_i) end def load_all(ids) all = @clazz.get_all(ids.map { |id| id.to_i }) if @custom_title all.each { |item| item.title = @custom_title } end all end def custom_title=(custom_title) @custom_title = custom_title end end end Sunspot::Adapters::DataAccessor.register(MockAdapter::DataAccessor, MockRecord) Sunspot::Adapters::InstanceAdapter.register(MockAdapter::InstanceAdapter, MockRecord)
Version data entries
5 entries across 5 versions & 1 rubygems