Overwriting of search method #20

Closed
zzet opened this Issue Feb 19, 2014 · 1 comment

Comments

Projects
None yet
2 participants

zzet commented Feb 19, 2014

Hi!

After update elasticsearch-rails form 46734cd to 88b6597 broken overwriting of search via

module Searchable
  extend ActiveSupport::Concern

  included do
    include Elasticsearch::Model

    mapping do
      # ...
    end

  end

  module ClassMethods
    def search(query)
      # ...
    end
  end

But it work with:

# In: app/models/concerns/searchable.rb
#
module Searchable
  extend ActiveSupport::Concern

  included do
    include Elasticsearch::Model

    mapping do
      # ...
    end

    def self.search(query)
      # ...
    end
  end
end

I think, problem with delegation and easy to update readme.

Owner

karmi commented Mar 1, 2014

@zzet Thanks for the report, I'll look into it. So the problem is that the bundled search method overwrites your own search method defined in the model?

@karmi karmi added the waiting label Mar 1, 2014

@karmi karmi closed this in 527e207 Mar 5, 2014

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment