Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Undefined method ruby2_keywords for Elasticsearch::Model::Proxy::Base:Module #1024

Open
qquokka opened this issue Mar 28, 2022 · 3 comments
Open
Labels

Comments

@qquokka
Copy link

qquokka commented Mar 28, 2022

Hi! I got a problem with elasticsearch-model gem while I was running rails console. It's been happening since I updated elasticsearch-model gem from 7.1.x to 7.2.1. My ruby version is ruby 2.6.6p146 (2020-03-31 revision 67876) [x86_64-darwin19].

Traceback (most recent call last):
	22: from bin/rails:6:in `<main>'
	21: from /Users/hyejin/.rbenv/versions/2.6.6/lib/ruby/gems/2.6.0/gems/bootsnap-1.11.1/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:30:in `require'
	20: from /Users/hyejin/.rbenv/versions/2.6.6/lib/ruby/gems/2.6.0/gems/bootsnap-1.11.1/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:30:in `require'
	19: from /Users/hyejin/.rbenv/versions/2.6.6/lib/ruby/gems/2.6.0/gems/railties-6.0.3.7/lib/rails/commands.rb:18:in `<main>'
	18: from /Users/hyejin/.rbenv/versions/2.6.6/lib/ruby/gems/2.6.0/gems/railties-6.0.3.7/lib/rails/command.rb:46:in `invoke'
	17: from /Users/hyejin/.rbenv/versions/2.6.6/lib/ruby/gems/2.6.0/gems/railties-6.0.3.7/lib/rails/command/base.rb:69:in `perform'
	16: from /Users/hyejin/.rbenv/versions/2.6.6/lib/ruby/gems/2.6.0/gems/thor-1.2.1/lib/thor.rb:392:in `dispatch'
	15: from /Users/hyejin/.rbenv/versions/2.6.6/lib/ruby/gems/2.6.0/gems/thor-1.2.1/lib/thor/invocation.rb:127:in `invoke_command'
	14: from /Users/hyejin/.rbenv/versions/2.6.6/lib/ruby/gems/2.6.0/gems/thor-1.2.1/lib/thor/command.rb:27:in `run'
	13: from /Users/hyejin/.rbenv/versions/2.6.6/lib/ruby/gems/2.6.0/gems/railties-6.0.3.7/lib/rails/commands/console/console_command.rb:101:in `perform'
	12: from /Users/hyejin/.rbenv/versions/2.6.6/lib/ruby/gems/2.6.0/gems/railties-6.0.3.7/lib/rails/command/actions.rb:14:in `require_application_and_environment!'
	11: from /Users/hyejin/.rbenv/versions/2.6.6/lib/ruby/gems/2.6.0/gems/railties-6.0.3.7/lib/rails/command/actions.rb:22:in `require_application!'
	10: from /Users/hyejin/.rbenv/versions/2.6.6/lib/ruby/gems/2.6.0/gems/bootsnap-1.11.1/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:30:in `require'
	 9: from /Users/hyejin/.rbenv/versions/2.6.6/lib/ruby/gems/2.6.0/gems/bootsnap-1.11.1/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:30:in `require'
	 8: from /Users/hyejin/workspace/deali/bird/config/application.rb:23:in `<main>'
	 7: from /Users/hyejin/.rbenv/versions/2.6.6/lib/ruby/gems/2.6.0/gems/bundler-2.1.4/lib/bundler.rb:174:in `require'
	 6: from /Users/hyejin/.rbenv/versions/2.6.6/lib/ruby/gems/2.6.0/gems/bundler-2.1.4/lib/bundler/runtime.rb:58:in `require'
	 5: from /Users/hyejin/.rbenv/versions/2.6.6/lib/ruby/gems/2.6.0/gems/bundler-2.1.4/lib/bundler/runtime.rb:58:in `each'
	 4: from /Users/hyejin/.rbenv/versions/2.6.6/lib/ruby/gems/2.6.0/gems/bundler-2.1.4/lib/bundler/runtime.rb:69:in `block in require'
	 3: from /Users/hyejin/.rbenv/versions/2.6.6/lib/ruby/gems/2.6.0/gems/bundler-2.1.4/lib/bundler/runtime.rb:69:in `each'
	 2: from /Users/hyejin/.rbenv/versions/2.6.6/lib/ruby/gems/2.6.0/gems/bundler-2.1.4/lib/bundler/runtime.rb:74:in `block (2 levels) in require'
	 1: from /Users/hyejin/.rbenv/versions/2.6.6/lib/ruby/gems/2.6.0/gems/bootsnap-1.11.1/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:15:in `require'
/Users/hyejin/.rbenv/versions/2.6.6/lib/ruby/gems/2.6.0/gems/bootsnap-1.11.1/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:15:in `require': cannot load such file -- elasticsearch-model (LoadError)
	33: from bin/rails:6:in `<main>'
	32: from /Users/hyejin/.rbenv/versions/2.6.6/lib/ruby/gems/2.6.0/gems/bootsnap-1.11.1/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:30:in `require'
	31: from /Users/hyejin/.rbenv/versions/2.6.6/lib/ruby/gems/2.6.0/gems/bootsnap-1.11.1/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:30:in `require'
	30: from /Users/hyejin/.rbenv/versions/2.6.6/lib/ruby/gems/2.6.0/gems/railties-6.0.3.7/lib/rails/commands.rb:18:in `<main>'
	29: from /Users/hyejin/.rbenv/versions/2.6.6/lib/ruby/gems/2.6.0/gems/railties-6.0.3.7/lib/rails/command.rb:46:in `invoke'
	28: from /Users/hyejin/.rbenv/versions/2.6.6/lib/ruby/gems/2.6.0/gems/railties-6.0.3.7/lib/rails/command/base.rb:69:in `perform'
	27: from /Users/hyejin/.rbenv/versions/2.6.6/lib/ruby/gems/2.6.0/gems/thor-1.2.1/lib/thor.rb:392:in `dispatch'
	26: from /Users/hyejin/.rbenv/versions/2.6.6/lib/ruby/gems/2.6.0/gems/thor-1.2.1/lib/thor/invocation.rb:127:in `invoke_command'
	25: from /Users/hyejin/.rbenv/versions/2.6.6/lib/ruby/gems/2.6.0/gems/thor-1.2.1/lib/thor/command.rb:27:in `run'
	24: from /Users/hyejin/.rbenv/versions/2.6.6/lib/ruby/gems/2.6.0/gems/railties-6.0.3.7/lib/rails/commands/console/console_command.rb:101:in `perform'
	23: from /Users/hyejin/.rbenv/versions/2.6.6/lib/ruby/gems/2.6.0/gems/railties-6.0.3.7/lib/rails/command/actions.rb:14:in `require_application_and_environment!'
	22: from /Users/hyejin/.rbenv/versions/2.6.6/lib/ruby/gems/2.6.0/gems/railties-6.0.3.7/lib/rails/command/actions.rb:22:in `require_application!'
	21: from /Users/hyejin/.rbenv/versions/2.6.6/lib/ruby/gems/2.6.0/gems/bootsnap-1.11.1/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:30:in `require'
	20: from /Users/hyejin/.rbenv/versions/2.6.6/lib/ruby/gems/2.6.0/gems/bootsnap-1.11.1/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:30:in `require'
	19: from /Users/hyejin/workspace/deali/bird/config/application.rb:23:in `<main>'
	18: from /Users/hyejin/.rbenv/versions/2.6.6/lib/ruby/gems/2.6.0/gems/bundler-2.1.4/lib/bundler.rb:174:in `require'
	17: from /Users/hyejin/.rbenv/versions/2.6.6/lib/ruby/gems/2.6.0/gems/bundler-2.1.4/lib/bundler/runtime.rb:58:in `require'
	16: from /Users/hyejin/.rbenv/versions/2.6.6/lib/ruby/gems/2.6.0/gems/bundler-2.1.4/lib/bundler/runtime.rb:58:in `each'
	15: from /Users/hyejin/.rbenv/versions/2.6.6/lib/ruby/gems/2.6.0/gems/bundler-2.1.4/lib/bundler/runtime.rb:65:in `block in require'
	14: from /Users/hyejin/.rbenv/versions/2.6.6/lib/ruby/gems/2.6.0/gems/bundler-2.1.4/lib/bundler/runtime.rb:88:in `rescue in block in require'
	13: from /Users/hyejin/.rbenv/versions/2.6.6/lib/ruby/gems/2.6.0/gems/bootsnap-1.11.1/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:30:in `require'
	12: from /Users/hyejin/.rbenv/versions/2.6.6/lib/ruby/gems/2.6.0/gems/bootsnap-1.11.1/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:30:in `require'
	11: from /Users/hyejin/.rbenv/versions/2.6.6/lib/ruby/gems/2.6.0/gems/elasticsearch-model-7.2.1/lib/elasticsearch/model.rb:44:in `<main>'
	10: from /Users/hyejin/.rbenv/versions/2.6.6/lib/ruby/gems/2.6.0/gems/activesupport-6.0.3.7/lib/active_support/dependencies.rb:324:in `require'
	 9: from /Users/hyejin/.rbenv/versions/2.6.6/lib/ruby/gems/2.6.0/gems/activesupport-6.0.3.7/lib/active_support/dependencies.rb:291:in `load_dependency'
	 8: from /Users/hyejin/.rbenv/versions/2.6.6/lib/ruby/gems/2.6.0/gems/activesupport-6.0.3.7/lib/active_support/dependencies.rb:324:in `block in require'
	 7: from /Users/hyejin/.rbenv/versions/2.6.6/lib/ruby/gems/2.6.0/gems/polyglot-0.3.5/lib/polyglot.rb:65:in `require'
	 6: from /Users/hyejin/.rbenv/versions/2.6.6/lib/ruby/gems/2.6.0/gems/bootsnap-1.11.1/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:30:in `require'
	 5: from /Users/hyejin/.rbenv/versions/2.6.6/lib/ruby/gems/2.6.0/gems/bootsnap-1.11.1/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:30:in `require'
	 4: from /Users/hyejin/.rbenv/versions/2.6.6/lib/ruby/gems/2.6.0/gems/elasticsearch-model-7.2.1/lib/elasticsearch/model/proxy.rb:18:in `<main>'
	 3: from /Users/hyejin/.rbenv/versions/2.6.6/lib/ruby/gems/2.6.0/gems/elasticsearch-model-7.2.1/lib/elasticsearch/model/proxy.rb:19:in `<module:Elasticsearch>'
	 2: from /Users/hyejin/.rbenv/versions/2.6.6/lib/ruby/gems/2.6.0/gems/elasticsearch-model-7.2.1/lib/elasticsearch/model/proxy.rb:47:in `<module:Model>'
	 1: from /Users/hyejin/.rbenv/versions/2.6.6/lib/ruby/gems/2.6.0/gems/elasticsearch-model-7.2.1/lib/elasticsearch/model/proxy.rb:111:in `<module:Proxy>'
/Users/hyejin/.rbenv/versions/2.6.6/lib/ruby/gems/2.6.0/gems/elasticsearch-model-7.2.1/lib/elasticsearch/model/proxy.rb:124:in `<module:Base>': undefined method `ruby2_keywords' for Elasticsearch::Model::Proxy::Base:Module (NoMethodError)
@qquokka qquokka changed the title undefined method ruby2_keywords for Elasticsearch::Model::Proxy::Base:Module Undefined method ruby2_keywords for Elasticsearch::Model::Proxy::Base:Module Mar 28, 2022
@habib-ali
Copy link

Is there any update on this bug ?
I am facing same issue with ruby-2.6.7 and elasticsearch-model-7.2.1/lib/elasticsearch/model/proxy.rb

@habib-ali
Copy link

Looking at the link present in the line

# Delegate methods to `@target`. As per [the Ruby 3.0 explanation for keyword arguments](https://www.ruby-lang.org/en/news/2019/12/12/separation-of-positional-and-keyword-arguments-in-ruby-3-0/), the only way to work on Ruby <2.7, and 2.7, and 3.0+ is to use `ruby2_keywords`.

I found at that using gem 'ruby2_keywords', '~> 0.0.5' in the gemfile solves this issue

@vijay-zensar
Copy link

I am facing this error while upgrading rails version 4.2 to 5.2.7. I have ruby version 2.6.9, Can anyone help me fix this issue?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants