lib/es_searchable.rb in es_searchable-0.1.1 vs lib/es_searchable.rb in es_searchable-0.2.0
- old
+ new
@@ -1,20 +1,24 @@
+require "active_support/all"
require "es_searchable/version"
require "es_searchable/configurable"
module EsSearchable
extend Configurable
extend ActiveSupport::Concern
included do
class << self
- delegate *SearchMethods, to: :es_collection, prefix: :es
+ extend Forwardable
+ SearchMethods.each do |meth|
+ def_delegator :es_collection, meth, "es_#{meth}"
+ end
end
end
module ClassMethods
def es_collection
- SearchCollection.new(self)
+ @es_collection = SearchCollection.new(self)
end
def handle_es_response(es_coll)
es_coll
end