Sha256: 8046b83ac60d880e9fbdc1d583c11d5b0b39afee90b6b50bf1ddd8a373df5ec3
Contents?: true
Size: 721 Bytes
Versions: 103
Compression:
Stored size: 721 Bytes
Contents
require File.join(File.dirname(__FILE__), 'post') 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
103 entries across 103 versions & 20 rubygems