Skip to content

Instantly share code, notes, and snippets.

@adam12
Forked from mfifth/full error
Last active January 20, 2017 03:36
Show Gist options
  • Save adam12/63952e0a32586194a6aa886cede01c2c to your computer and use it in GitHub Desktop.
Save adam12/63952e0a32586194a6aa886cede01c2c to your computer and use it in GitHub Desktop.
require 'sunspot'
require 'sunspot/rails'
require 'feedjira/feed'
module Sunspot
module Feedjira::Feed
def self.included(base)
base.class_eval do
extend Sunspot::Rails::Searchable::ActsAsMethods
Sunspot::Adapters::DataAccessor.register(DataAccessor, base)
Sunspot::Adapters::InstanceAdapter.register(InstanceAdapter, base)
end
end
class InstanceAdapter < Sunspot::Adapters::InstanceAdapter
def id
@instance.id
end
end
class DataAccessor < Sunspot::Adapters::DataAccessor
def load_all(ids)
entries.select { |entry| ids.include?(entry.id) }
end
def load(id)
entries[id]
end
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment