ronzalo / spree_searchkick

Add Elasticsearch goodies to Spree, powered by searchkick
BSD 3-Clause "New" or "Revised" License
31 stars 57 forks source link

product_decorator.rb loaded twice in production environment #7

Closed woto closed 7 years ago

woto commented 8 years ago

Hi in production environment i've got this error

/home/woto/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/bundler/gems/searchkick-1f76d066f83b/lib/searchkick/model.rb:6:in `searchkick': Only call searchkick once per model (RuntimeError)

It seems it happens because of prouct_decorator.rb locaded twice

i've added

puts 'app/models/spree/product_decorator.rb loaded'
puts '============================================'
puts caller

Spree::Product.class_eval do
  searchkick autocomplete: [:name]

to product_decorator.rb for debugging.

[WARNING] You are not setting Devise.secret_key within your application!
You must set this in config/initializers/devise.rb. Here's an example:

Devise.secret_key = "7e8d654114b305e7828e4b5eb47b22d903155033262eb68f617e020c021bb0586b2282abd5a9dd619a2721e688f1544773bb"
app/models/spree/product_decorator.rb loaded
============================================
/home/woto/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/polyglot-0.3.5/lib/polyglot.rb:65:in `require'
/home/woto/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/polyglot-0.3.5/lib/polyglot.rb:65:in `require'
/home/woto/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/activesupport-4.2.6/lib/active_support/dependencies.rb:274:in `block in require'
/home/woto/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/activesupport-4.2.6/lib/active_support/dependencies.rb:240:in `load_dependency'
/home/woto/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/activesupport-4.2.6/lib/active_support/dependencies.rb:274:in `require'
/home/woto/rails/spree_searchkick/lib/spree_searchkick/engine.rb:16:in `block in activate'
/home/woto/rails/spree_searchkick/lib/spree_searchkick/engine.rb:15:in `glob'
/home/woto/rails/spree_searchkick/lib/spree_searchkick/engine.rb:15:in `activate'
/home/woto/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/activesupport-4.2.6/lib/active_support/callbacks.rb:446:in `instance_exec'
/home/woto/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/activesupport-4.2.6/lib/active_support/callbacks.rb:446:in `block in make_lambda'
/home/woto/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/activesupport-4.2.6/lib/active_support/callbacks.rb:192:in `call'
/home/woto/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/activesupport-4.2.6/lib/active_support/callbacks.rb:192:in `block in simple'
/home/woto/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/activesupport-4.2.6/lib/active_support/callbacks.rb:504:in `call'
/home/woto/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/activesupport-4.2.6/lib/active_support/callbacks.rb:504:in `block in call'
/home/woto/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/activesupport-4.2.6/lib/active_support/callbacks.rb:504:in `each'
/home/woto/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/activesupport-4.2.6/lib/active_support/callbacks.rb:504:in `call'
/home/woto/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/activesupport-4.2.6/lib/active_support/callbacks.rb:92:in `__run_callbacks__'
/home/woto/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/activesupport-4.2.6/lib/active_support/callbacks.rb:778:in `_run_prepare_callbacks'
/home/woto/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/activesupport-4.2.6/lib/active_support/callbacks.rb:81:in `run_callbacks'
/home/woto/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/actionpack-4.2.6/lib/action_dispatch/middleware/reloader.rb:83:in `prepare!'
/home/woto/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/actionpack-4.2.6/lib/action_dispatch/middleware/reloader.rb:55:in `prepare!'
/home/woto/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/railties-4.2.6/lib/rails/application/finisher.rb:50:in `block in <module:Finisher>'
/home/woto/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/railties-4.2.6/lib/rails/initializable.rb:30:in `instance_exec'
/home/woto/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/railties-4.2.6/lib/rails/initializable.rb:30:in `run'
/home/woto/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/railties-4.2.6/lib/rails/initializable.rb:55:in `block in run_initializers'
/home/woto/.rbenv/versions/2.1.2/lib/ruby/2.1.0/tsort.rb:226:in `block in tsort_each'
/home/woto/.rbenv/versions/2.1.2/lib/ruby/2.1.0/tsort.rb:348:in `block (2 levels) in each_strongly_connected_component'
/home/woto/.rbenv/versions/2.1.2/lib/ruby/2.1.0/tsort.rb:427:in `each_strongly_connected_component_from'
/home/woto/.rbenv/versions/2.1.2/lib/ruby/2.1.0/tsort.rb:347:in `block in each_strongly_connected_component'
/home/woto/.rbenv/versions/2.1.2/lib/ruby/2.1.0/tsort.rb:345:in `each'
/home/woto/.rbenv/versions/2.1.2/lib/ruby/2.1.0/tsort.rb:345:in `call'
/home/woto/.rbenv/versions/2.1.2/lib/ruby/2.1.0/tsort.rb:345:in `each_strongly_connected_component'
/home/woto/.rbenv/versions/2.1.2/lib/ruby/2.1.0/tsort.rb:224:in `tsort_each'
/home/woto/.rbenv/versions/2.1.2/lib/ruby/2.1.0/tsort.rb:205:in `tsort_each'
/home/woto/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/railties-4.2.6/lib/rails/initializable.rb:54:in `run_initializers'
/home/woto/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/railties-4.2.6/lib/rails/application.rb:352:in `initialize!'
/home/woto/rails/triglav/config/environment.rb:5:in `<top (required)>'
/home/woto/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/polyglot-0.3.5/lib/polyglot.rb:65:in `require'
/home/woto/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/polyglot-0.3.5/lib/polyglot.rb:65:in `require'
/home/woto/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/activesupport-4.2.6/lib/active_support/dependencies.rb:274:in `block in require'
/home/woto/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/activesupport-4.2.6/lib/active_support/dependencies.rb:240:in `load_dependency'
/home/woto/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/activesupport-4.2.6/lib/active_support/dependencies.rb:274:in `require'
/home/woto/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/spring-1.7.1/lib/spring/application.rb:92:in `preload'
/home/woto/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/spring-1.7.1/lib/spring/application.rb:143:in `serve'
/home/woto/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/spring-1.7.1/lib/spring/application.rb:131:in `block in run'
/home/woto/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/spring-1.7.1/lib/spring/application.rb:125:in `loop'
/home/woto/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/spring-1.7.1/lib/spring/application.rb:125:in `run'
/home/woto/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/spring-1.7.1/lib/spring/application/boot.rb:19:in `<top (required)>'
/home/woto/.rbenv/versions/2.1.2/lib/ruby/site_ruby/2.1.0/rubygems/core_ext/kernel_require.rb:55:in `require'
/home/woto/.rbenv/versions/2.1.2/lib/ruby/site_ruby/2.1.0/rubygems/core_ext/kernel_require.rb:55:in `require'
-e:1:in `<main>'
app/models/spree/product_decorator.rb loaded
============================================
/home/woto/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/activesupport-4.2.6/lib/active_support/dependencies.rb:457:in `load'
/home/woto/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/activesupport-4.2.6/lib/active_support/dependencies.rb:457:in `block in load_file'
/home/woto/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/activesupport-4.2.6/lib/active_support/dependencies.rb:647:in `new_constants_in'
/home/woto/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/activesupport-4.2.6/lib/active_support/dependencies.rb:456:in `load_file'
/home/woto/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/activesupport-4.2.6/lib/active_support/dependencies.rb:354:in `require_or_load'
/home/woto/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/activesupport-4.2.6/lib/active_support/dependencies.rb:317:in `depend_on'
/home/woto/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/activesupport-4.2.6/lib/active_support/dependencies.rb:233:in `require_dependency'
/home/woto/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/railties-4.2.6/lib/rails/engine.rb:472:in `block (2 levels) in eager_load!'
/home/woto/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/railties-4.2.6/lib/rails/engine.rb:471:in `each'
/home/woto/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/railties-4.2.6/lib/rails/engine.rb:471:in `block in eager_load!'
/home/woto/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/railties-4.2.6/lib/rails/engine.rb:469:in `each'
/home/woto/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/railties-4.2.6/lib/rails/engine.rb:469:in `eager_load!'
/home/woto/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/railties-4.2.6/lib/rails/engine.rb:346:in `eager_load!'
/home/woto/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/railties-4.2.6/lib/rails/application/finisher.rb:56:in `each'
/home/woto/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/railties-4.2.6/lib/rails/application/finisher.rb:56:in `block in <module:Finisher>'
/home/woto/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/railties-4.2.6/lib/rails/initializable.rb:30:in `instance_exec'
/home/woto/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/railties-4.2.6/lib/rails/initializable.rb:30:in `run'
/home/woto/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/railties-4.2.6/lib/rails/initializable.rb:55:in `block in run_initializers'
/home/woto/.rbenv/versions/2.1.2/lib/ruby/2.1.0/tsort.rb:226:in `block in tsort_each'
/home/woto/.rbenv/versions/2.1.2/lib/ruby/2.1.0/tsort.rb:348:in `block (2 levels) in each_strongly_connected_component'
/home/woto/.rbenv/versions/2.1.2/lib/ruby/2.1.0/tsort.rb:427:in `each_strongly_connected_component_from'
/home/woto/.rbenv/versions/2.1.2/lib/ruby/2.1.0/tsort.rb:347:in `block in each_strongly_connected_component'
/home/woto/.rbenv/versions/2.1.2/lib/ruby/2.1.0/tsort.rb:345:in `each'
/home/woto/.rbenv/versions/2.1.2/lib/ruby/2.1.0/tsort.rb:345:in `call'
/home/woto/.rbenv/versions/2.1.2/lib/ruby/2.1.0/tsort.rb:345:in `each_strongly_connected_component'
/home/woto/.rbenv/versions/2.1.2/lib/ruby/2.1.0/tsort.rb:224:in `tsort_each'
/home/woto/.rbenv/versions/2.1.2/lib/ruby/2.1.0/tsort.rb:205:in `tsort_each'
/home/woto/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/railties-4.2.6/lib/rails/initializable.rb:54:in `run_initializers'
/home/woto/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/railties-4.2.6/lib/rails/application.rb:352:in `initialize!'
/home/woto/rails/triglav/config/environment.rb:5:in `<top (required)>'
/home/woto/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/polyglot-0.3.5/lib/polyglot.rb:65:in `require'
/home/woto/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/polyglot-0.3.5/lib/polyglot.rb:65:in `require'
/home/woto/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/activesupport-4.2.6/lib/active_support/dependencies.rb:274:in `block in require'
/home/woto/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/activesupport-4.2.6/lib/active_support/dependencies.rb:240:in `load_dependency'
/home/woto/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/activesupport-4.2.6/lib/active_support/dependencies.rb:274:in `require'
/home/woto/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/spring-1.7.1/lib/spring/application.rb:92:in `preload'
/home/woto/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/spring-1.7.1/lib/spring/application.rb:143:in `serve'
/home/woto/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/spring-1.7.1/lib/spring/application.rb:131:in `block in run'
/home/woto/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/spring-1.7.1/lib/spring/application.rb:125:in `loop'
/home/woto/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/spring-1.7.1/lib/spring/application.rb:125:in `run'
/home/woto/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/spring-1.7.1/lib/spring/application/boot.rb:19:in `<top (required)>'
/home/woto/.rbenv/versions/2.1.2/lib/ruby/site_ruby/2.1.0/rubygems/core_ext/kernel_require.rb:55:in `require'
/home/woto/.rbenv/versions/2.1.2/lib/ruby/site_ruby/2.1.0/rubygems/core_ext/kernel_require.rb:55:in `require'
-e:1:in `<main>'
/home/woto/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/bundler/gems/searchkick-1f76d066f83b/lib/searchkick/model.rb:6:in `searchkick': Only call searchkick once per model (RuntimeError)
    from /home/woto/rails/spree_searchkick/app/models/spree/product_decorator.rb:6:in `block in <top (required)>'
    from /home/woto/rails/spree_searchkick/app/models/spree/product_decorator.rb:5:in `class_eval'
    from /home/woto/rails/spree_searchkick/app/models/spree/product_decorator.rb:5:in `<top (required)>'
    from /home/woto/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/activesupport-4.2.6/lib/active_support/dependencies.rb:457:in `load'
    from /home/woto/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/activesupport-4.2.6/lib/active_support/dependencies.rb:457:in `block in load_file'
    from /home/woto/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/activesupport-4.2.6/lib/active_support/dependencies.rb:647:in `new_constants_in'
    from /home/woto/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/activesupport-4.2.6/lib/active_support/dependencies.rb:456:in `load_file'
    from /home/woto/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/activesupport-4.2.6/lib/active_support/dependencies.rb:354:in `require_or_load'
    from /home/woto/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/activesupport-4.2.6/lib/active_support/dependencies.rb:317:in `depend_on'
    from /home/woto/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/activesupport-4.2.6/lib/active_support/dependencies.rb:233:in `require_dependency'
    from /home/woto/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/railties-4.2.6/lib/rails/engine.rb:472:in `block (2 levels) in eager_load!'
    from /home/woto/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/railties-4.2.6/lib/rails/engine.rb:471:in `each'
    from /home/woto/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/railties-4.2.6/lib/rails/engine.rb:471:in `block in eager_load!'
    from /home/woto/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/railties-4.2.6/lib/rails/engine.rb:469:in `each'
    from /home/woto/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/railties-4.2.6/lib/rails/engine.rb:469:in `eager_load!'
    from /home/woto/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/railties-4.2.6/lib/rails/engine.rb:346:in `eager_load!'
    from /home/woto/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/railties-4.2.6/lib/rails/application/finisher.rb:56:in `each'
    from /home/woto/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/railties-4.2.6/lib/rails/application/finisher.rb:56:in `block in <module:Finisher>'
    from /home/woto/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/railties-4.2.6/lib/rails/initializable.rb:30:in `instance_exec'
    from /home/woto/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/railties-4.2.6/lib/rails/initializable.rb:30:in `run'
    from /home/woto/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/railties-4.2.6/lib/rails/initializable.rb:55:in `block in run_initializers'
    from /home/woto/.rbenv/versions/2.1.2/lib/ruby/2.1.0/tsort.rb:226:in `block in tsort_each'
    from /home/woto/.rbenv/versions/2.1.2/lib/ruby/2.1.0/tsort.rb:348:in `block (2 levels) in each_strongly_connected_component'
    from /home/woto/.rbenv/versions/2.1.2/lib/ruby/2.1.0/tsort.rb:427:in `each_strongly_connected_component_from'
    from /home/woto/.rbenv/versions/2.1.2/lib/ruby/2.1.0/tsort.rb:347:in `block in each_strongly_connected_component'
    from /home/woto/.rbenv/versions/2.1.2/lib/ruby/2.1.0/tsort.rb:345:in `each'
    from /home/woto/.rbenv/versions/2.1.2/lib/ruby/2.1.0/tsort.rb:345:in `call'
    from /home/woto/.rbenv/versions/2.1.2/lib/ruby/2.1.0/tsort.rb:345:in `each_strongly_connected_component'
    from /home/woto/.rbenv/versions/2.1.2/lib/ruby/2.1.0/tsort.rb:224:in `tsort_each'
    from /home/woto/.rbenv/versions/2.1.2/lib/ruby/2.1.0/tsort.rb:205:in `tsort_each'
    from /home/woto/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/railties-4.2.6/lib/rails/initializable.rb:54:in `run_initializers'
    from /home/woto/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/railties-4.2.6/lib/rails/application.rb:352:in `initialize!'
    from /home/woto/rails/triglav/config/environment.rb:5:in `<top (required)>'
    from /home/woto/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/polyglot-0.3.5/lib/polyglot.rb:65:in `require'
    from /home/woto/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/polyglot-0.3.5/lib/polyglot.rb:65:in `require'
    from /home/woto/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/activesupport-4.2.6/lib/active_support/dependencies.rb:274:in `block in require'
    from /home/woto/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/activesupport-4.2.6/lib/active_support/dependencies.rb:240:in `load_dependency'
    from /home/woto/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/activesupport-4.2.6/lib/active_support/dependencies.rb:274:in `require'
    from /home/woto/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/spring-1.7.1/lib/spring/application.rb:92:in `preload'
    from /home/woto/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/spring-1.7.1/lib/spring/application.rb:143:in `serve'
    from /home/woto/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/spring-1.7.1/lib/spring/application.rb:131:in `block in run'
    from /home/woto/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/spring-1.7.1/lib/spring/application.rb:125:in `loop'
    from /home/woto/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/spring-1.7.1/lib/spring/application.rb:125:in `run'
    from /home/woto/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/spring-1.7.1/lib/spring/application/boot.rb:19:in `<top (required)>'
    from /home/woto/.rbenv/versions/2.1.2/lib/ruby/site_ruby/2.1.0/rubygems/core_ext/kernel_require.rb:55:in `require'
    from /home/woto/.rbenv/versions/2.1.2/lib/ruby/site_ruby/2.1.0/rubygems/core_ext/kernel_require.rb:55:in `require'
    from -e:1:in `<main>'

When i commenting out config.to_prepare &method(:activate).to_proc in lib/spree_searchkick/engine.rb the error is gone. Still don't know why it happens. Nobody else don't have this problem?

ronzalo commented 8 years ago

@woto try this:

searchkick (...options here) unless respond_to?(:searchkick_index)
woto commented 8 years ago

@ronzalo Yeah, it works, it seems i saw same technique somewhere. But i had not tried it because i thought that it's not a correct way.

joelataylor commented 7 years ago

@woto I'm experiencing the same issue with a user_decorator.rb file. When I have a validates defined, it get's called twice, meaning I get double the error message output. And it only happens in staging/production.

Suggestions?

woto commented 7 years ago

Sorry, nope, i don't working on this task anymore

14 дек. 2016 г. 5:32 AM пользователь "Joel Taylor" notifications@github.com написал:

@woto https://github.com/woto I'm experiencing the same issue with a user_decorator.rb file. When I have a validates defined, it get's called twice, meaning I get double the error message output. And it only happens in staging/production.

Suggestions?

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/ronzalo/spree_searchkick/issues/7#issuecomment-266925595, or mute the thread https://github.com/notifications/unsubscribe-auth/AAI9EMiP7PAgAl0AYP7GweMMl4vqFrmDks5rH1VPgaJpZM4IPadz .

ronzalo commented 7 years ago

@joelataylor it's a searchkick issue, see https://github.com/ankane/searchkick/issues/596

ronzalo commented 7 years ago

@joelataylor Since searchkick does not allow you to call more than once, you can add this to override the behavior self.class_variable_set :@@searchkick_options, {}

FX-HAO commented 6 years ago

@joelataylor I got the same problem. Did you find a way to fix it?

joelataylor commented 6 years ago

@FX-HAO sorry, I can't remember what the fix was!

ronzalo commented 6 years ago

hi guys, knowing that searchkick doesn't allow to override inherited method (see https://github.com/ankane/searchkick/issues/313), the correct way (imho) to solve this is move that logic out of the gem and put it on the project itself

DiegoOrejuela commented 4 years ago

@joelataylor Since searchkick does not allow you to call more than once, you can add this to override the behavior self.class_variable_set :@@searchkick_options, {}

For me works this way. And also can change value of class variables @@searchkick_index, @@searchkick_klass, @@searchkick_index_cache in a method class, and make a wrapper function of search for use in default method.