-
-
Save adam12/63952e0a32586194a6aa886cede01c2c to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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