Redmine / 插件迁移错误

Redmine / error on plugin migration

我尝试将 Redmine 0.9.1 迁移到 3.4.2,但一个迁移插件失败了。 插件是 question

使用此命令我的插件迁移失败。

bundle exec rake redmine:plugins:migrate RAILS_ENV=production  

我有这个输出:

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)  

我的 gem 安装是这样的:

* 本地宝石 *

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)  

我的 Redmine、Ruby、Gem 和 Bundler 版本:

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

感谢您的帮助,

Amauche,

真正失败的不是迁移,而是redmine的初始化。因此,您将根本无法启动 redmine。

原因可能是因为 all 方法和 rails 4 发生了变化(虽然我没能发现确切的变化)。但是该插件所做的是尝试为 all 方法定义别名,而该方法不存在(不再存在)。

由于对插件存储库的最后一次更改是在两年前,除非您想加强并维护 plugin/issue 对存储库的 PR,否则您在尝试迁移插件时可能运气不佳你自己。