rubyrubygemsredmineredmine-plugins

Redmine / error on plugin migration


I try to migrate Redmine 0.9.1 to 3.4.2 and one migration plugin failed. The plugins is question

My plugins migration failed with this command.

bundle exec rake redmine:plugins:migrate RAILS_ENV=production  

I have this output:

rake aborted!  
NameError: undefined method `all' for class `ActiveRecord::Relation'  
/opt/redmine/redmine-3.4.2/plugins/question_plugin/lib/question_active_record_relation_patch.rb:13:in `alias_method'  
/opt/redmine/redmine-3.4.2/plugins/question_plugin/lib/question_active_record_relation_patch.rb:13:in `block in included'  
/opt/redmine/redmine-3.4.2/plugins/question_plugin/lib/question_active_record_relation_patch.rb:7:in `class_eval'  
/opt/redmine/redmine-3.4.2/plugins/question_plugin/lib/question_active_record_relation_patch.rb:7:in `included'  
/opt/redmine/redmine-3.4.2/plugins/question_plugin/init.rb:10:in `include'  
/opt/redmine/redmine-3.4.2/plugins/question_plugin/init.rb:10:in `block in '  
/var/lib/gems/2.3.0/gems/activesupport-4.2.8/lib/active_support/callbacks.rb:446:in `instance_exec'  
/var/lib/gems/2.3.0/gems/activesupport-4.2.8/lib/active_support/callbacks.rb:446:in `block in make_lambda'  
/var/lib/gems/2.3.0/gems/activesupport-4.2.8/lib/active_support/callbacks.rb:192:in `block in simple'  
/var/lib/gems/2.3.0/gems/activesupport-4.2.8/lib/active_support/callbacks.rb:504:in `block in call'  
/var/lib/gems/2.3.0/gems/activesupport-4.2.8/lib/active_support/callbacks.rb:504:in `each'  
/var/lib/gems/2.3.0/gems/activesupport-4.2.8/lib/active_support/callbacks.rb:504:in `call'  
/var/lib/gems/2.3.0/gems/activesupport-4.2.8/lib/active_support/callbacks.rb:92:in `__run_callbacks__'  
/var/lib/gems/2.3.0/gems/activesupport-4.2.8/lib/active_support/callbacks.rb:778:in `_run_prepare_callbacks'  
/var/lib/gems/2.3.0/gems/activesupport-4.2.8/lib/active_support/callbacks.rb:81:in `run_callbacks'  
/var/lib/gems/2.3.0/gems/actionpack-4.2.8/lib/action_dispatch/middleware/reloader.rb:83:in `prepare!'  
/var/lib/gems/2.3.0/gems/actionpack-4.2.8/lib/action_dispatch/middleware/reloader.rb:55:in `prepare!'  
/var/lib/gems/2.3.0/gems/railties-4.2.8/lib/rails/application/finisher.rb:50:in `block in '  
/var/lib/gems/2.3.0/gems/railties-4.2.8/lib/rails/initializable.rb:30:in `instance_exec'  
/var/lib/gems/2.3.0/gems/railties-4.2.8/lib/rails/initializable.rb:30:in `run'  
/var/lib/gems/2.3.0/gems/railties-4.2.8/lib/rails/initializable.rb:55:in `block in run_initializers'  
/var/lib/gems/2.3.0/gems/railties-4.2.8/lib/rails/initializable.rb:54:in `run_initializers'  
/var/lib/gems/2.3.0/gems/railties-4.2.8/lib/rails/application.rb:352:in `initialize!'  
/opt/redmine/redmine-3.4.2/config/environment.rb:14:in `'  
/var/lib/gems/2.3.0/gems/railties-4.2.8/lib/rails/application.rb:328:in `require'  
/var/lib/gems/2.3.0/gems/railties-4.2.8/lib/rails/application.rb:328:in `require_environment!'  
/var/lib/gems/2.3.0/gems/railties-4.2.8/lib/rails/application.rb:457:in `block in run_tasks_blocks'  
/var/lib/gems/2.3.0/gems/rake-12.1.0/exe/rake:27:in `'  
Tasks: TOP => redmine:plugins:migrate => environment  
(See full trace by running task with --trace)  

My gem installed are this:

* LOCAL GEMS *

actionmailer (4.2.8, 4.2.6)  
actionpack (4.2.8, 4.2.6)  
actionpack-action_caching (1.1.1)  
actionpack-xml_parser (1.0.2)  
actionview (4.2.8, 4.2.6)  
activejob (4.2.8, 4.2.6)  
activemodel (5.1.4, 4.2.8, 4.2.6)  
activerecord (5.1.4, 4.2.8, 4.2.6)  
activeresource (2.3.18)  
activesupport (5.1.4, 4.2.8, 4.2.6, 2.3.18)  
addressable (2.5.2, 2.4.0, 2.3.8)  
arel (8.0.0, 6.0.4, 6.0.3)  
atomic (1.1.16)  
awesome_nested_set (3.0.0)  
axiom-types (0.1.1)  
bigdecimal (1.2.8)  
binding_of_caller (0.7.2)  
blankslate (3.1.3)  
builder (3.2.3, 3.2.2)  
bundler (1.11.2)  
byebug (5.0.0)  
coderay (1.1.2, 1.1.1)  
coercible (1.0.0)  
coffee-rails (4.1.0)  
coffee-script (2.4.1)  
coffee-script-source (1.9.1.1)  
columnize (0.9.0)  
concurrent-ruby (1.0.5)  
contracts (0.16.0)  
css_parser (1.6.0, 1.5.0, 1.3.6)  
debug_inspector (0.0.2)  
deface (1.2.0)  
descendants_tracker (0.0.4)  
did_you_mean (1.0.0)  
equalizer (0.0.11)  
erubis (2.7.0)  
eventmachine (1.0.7)  
execjs (2.6.0)  
faraday (0.13.1)  
ffi (1.9.10)  
globalid (0.4.0, 0.3.6)  
hike (1.2.1)  
htmlentities (4.3.4, 4.3.3)  
i18n (0.7.0)  
ice_nine (0.11.2)  
io-console (0.4.5)  
issues (0.0.2)  
jbuilder (2.3.1)  
journal (0.0.7)  
jquery-rails (4.0.5, 3.1.4)  
json (1.8.3)  
kanban (0.8.1)  
layout (0.2.1)  
listen (3.0.3)  
lockfile (2.1.3)  
loofah (2.0.3)  
mail (2.6.6, 2.6.3)  
mime-types (3.1, 2.6.1)  
mime-types-data (3.2016.0521)  
mimemagic (0.3.2)  
mini_portile2 (2.1.0)  
minitest (5.10.3, 5.8.4)  
molinillo (0.4.3)  
money (6.9.0)  
multi_json (1.11.2)  
multipart-post (2.0.0)  
mysql2 (0.4.9, 0.4.3)  
net-http-persistent (2.9.4)  
net-ldap (0.12.1, 0.8.0)  
net-telnet (0.1.1)  
nokogiri (1.7.2, 1.6.7.2)  
oj (2.12.10)  
polyglot (0.3.5, 0.3.4)  
power_assert (0.2.7)  
protected_attributes (1.1.4, 1.1.3)  
psych (2.0.17)  
public_suffix (3.0.0)  
rack (1.6.8, 1.6.4)  
rack-openid (1.4.2)  
rack-test (0.6.3)  
rails (4.2.8, 4.2.6)  
rails-deprecated_sanitizer (1.0.3)  
rails-dom-testing (1.0.8, 1.0.6)  
rails-html-sanitizer (1.0.3)  
rails-observers (0.1.2)  
railties (4.2.8, 4.2.6)  
rainbow (2.2.2)  
rake (12.1.0, 12.0.0, 10.5.0)  
rb-inotify (0.9.7)  
rbpdf (1.19.3, 1.19.2, 1.19.0)  
rbpdf-font (1.19.1, 1.19.0)  
rdoc (4.2.1)  
redcarpet (3.4.0, 3.3.4)  
redis (4.0.0, 3.3.3)  
redmine_client (0.0.1)  
request_store (1.3.0, 1.0.5)  
rmagick (2.16.0, 2.15.4)  
roadie (3.2.2, 3.1.1)  
roadie-rails (1.1.1, 1.1.0)  
ruby-hmac (0.4.0)  
ruby-openid (2.7.0, 2.3.0)  
sass (3.4.21)  
sass-rails (5.0.4)  
sdoc (0.4.1)  
spring (1.3.6)  
sprockets (3.7.1, 3.3.0)  
sprockets-rails (3.2.1, 2.3.2)  
sqlite3 (1.3.11)  
test-unit (3.1.7)  
thor (0.20.0, 0.19.1)  
thread_safe (0.3.6, 0.3.5)  
tilt (2.0.1)  
treetop (1.6.3)  
turbolinks (2.5.3)  
tzinfo (1.2.3, 1.2.2)  
uglifier (2.7.2)  
virtus (1.0.5)  
web-console (2.2.1)  

My Redmine, Ruby, Gem and Bundler version:

- Redmine 3.4.2 
- ruby 2.3.1p112 (2016-04-26) [x86_64-linux-gnu] 
- gem 2.5.1  
- Bundler version 1.11.2 

Thanks for your help,

Amauche,


Solution

  • It's not really the migration that fails but redmine's initialization. As such, you will not be able to start redmine at all.

    The cause is probably because of changes to the all method with rails 4 (although I haven't been able to spot the exact change). But what that plugin does is trying to define an alias for the all method and that method does not exist (any more).

    As the last change to the plugin repository was two years ago, you are probably out of luck when trying to migrate the plugin along unless you want to step up and maintain the plugin/issue a PR to the repo yourself.