Restream/redmine_elasticsearch

Rails 4.2

Closed this issue · 1 comments

Hello! Can you help me make work, elasticsearch in redmine, with rails 4.2?
I got some error:

[root@locarmine upd_redmine]# bundle exec rake redmine_elasticsearch:reindex_all RAILS_ENV=production --trace
Loading Rails environment for Resque
** Invoke redmine_elasticsearch:reindex_all (first_time)
** Invoke redmine_elasticsearch:logged (first_time)
** Invoke environment (first_time)
** Execute environment
** Execute redmine_elasticsearch:logged
** Execute redmine_elasticsearch:reindex_all
Recreate index for all available search types
rake aborted!
NoMethodError: undefined method scoped' for #<Class:0x0000000500f820> /usr/local/rvm/gems/ruby-1.9.3-p551/gems/activerecord-4.2.0/lib/active_record/dynamic_matchers.rb:26:inmethod_missing'
/var/www/upd_redmine/plugins/redmine_elasticsearch/app/models/parent_project.rb:57:in searching_scope' /var/www/upd_redmine/plugins/redmine_elasticsearch/lib/redmine_elasticsearch/indexer_service.rb:45:infor_each_parent_project'
/var/www/upd_redmine/plugins/redmine_elasticsearch/lib/redmine_elasticsearch/indexer_service.rb:18:in reindex_all' /var/www/upd_redmine/plugins/redmine_elasticsearch/lib/tasks/index.rake:18:inblock (2 levels) in <top (required)>'
/usr/local/rvm/gems/ruby-1.9.3-p551/gems/rake-10.4.2/lib/rake/task.rb:240:in call' /usr/local/rvm/gems/ruby-1.9.3-p551/gems/rake-10.4.2/lib/rake/task.rb:240:inblock in execute'
/usr/local/rvm/gems/ruby-1.9.3-p551/gems/rake-10.4.2/lib/rake/task.rb:235:in each' /usr/local/rvm/gems/ruby-1.9.3-p551/gems/rake-10.4.2/lib/rake/task.rb:235:inexecute'
/usr/local/rvm/gems/ruby-1.9.3-p551/gems/rake-10.4.2/lib/rake/task.rb:179:in block in invoke_with_call_chain' /usr/local/rvm/rubies/ruby-1.9.3-p551/lib/ruby/1.9.1/monitor.rb:211:inmon_synchronize'
/usr/local/rvm/gems/ruby-1.9.3-p551/gems/rake-10.4.2/lib/rake/task.rb:172:in invoke_with_call_chain' /usr/local/rvm/gems/ruby-1.9.3-p551/gems/rake-10.4.2/lib/rake/task.rb:165:ininvoke'
/usr/local/rvm/gems/ruby-1.9.3-p551/gems/rake-10.4.2/lib/rake/application.rb:150:in invoke_task' /usr/local/rvm/gems/ruby-1.9.3-p551/gems/rake-10.4.2/lib/rake/application.rb:106:inblock (2 levels) in top_level'
/usr/local/rvm/gems/ruby-1.9.3-p551/gems/rake-10.4.2/lib/rake/application.rb:106:in each' /usr/local/rvm/gems/ruby-1.9.3-p551/gems/rake-10.4.2/lib/rake/application.rb:106:inblock in top_level'
/usr/local/rvm/gems/ruby-1.9.3-p551/gems/rake-10.4.2/lib/rake/application.rb:115:in run_with_threads' /usr/local/rvm/gems/ruby-1.9.3-p551/gems/rake-10.4.2/lib/rake/application.rb:100:intop_level'
/usr/local/rvm/gems/ruby-1.9.3-p551/gems/rake-10.4.2/lib/rake/application.rb:78:in block in run' /usr/local/rvm/gems/ruby-1.9.3-p551/gems/rake-10.4.2/lib/rake/application.rb:176:instandard_exception_handling'
/usr/local/rvm/gems/ruby-1.9.3-p551/gems/rake-10.4.2/lib/rake/application.rb:75:in run' /usr/local/rvm/gems/ruby-1.9.3-p551/gems/rake-10.4.2/bin/rake:33:in<top (required)>'
/usr/local/rvm/gems/ruby-1.9.3-p551/bin/rake:23:in load' /usr/local/rvm/gems/ruby-1.9.3-p551/bin/rake:23:in

'
/usr/local/rvm/gems/ruby-1.9.3-p551/bin/ruby_executable_hooks:15:in eval' /usr/local/rvm/gems/ruby-1.9.3-p551/bin/ruby_executable_hooks:15:in'
Tasks: TOP => redmine_elasticsearch:reindex_all

I got the same issue (since Redmine switched to Rails 4 with its 3.0 version), and found that if you modify line 57 of app/models/parent_project.rb
from
self.scoped
to
self.all
it fixes the issue.
Please refer (for example) to rails/rails#12756 indicating that .scoped is deprecated in Rails 4