降级 Ruby 和 Rails 后 'undefined method' 变得频繁 "Redmine 500 Error"

Getting frequent "Redmine 500 Error" by 'undefined method' after Downgrading Ruby and Rails

我尝试将 Ruby 版本从 2.5.0 更改为 2.4.1,并将 Rails 版本从 5.1.2 更改为 4.2.1,因为应用了插件。

Environment:

Redmine version - 3.4.4.devel

Ruby version - 2.4.1-p111 (2017-03-22) [x86_64-darwin16]
Rails version - 4.2.8

Environment - production

Database adapter - Mysql2

我是 Rails 上的 Ruby 的新手。我应该在这里做什么?

ActionView::Template::Error (undefined method `public_compute_asset_path' for #<#<Class:0x007f86344e0180>:0x007f86344d0f78>):
  config/initializers/10-patches.rb:221:in `rails_asset_id'

NoMethodError (undefined method `saved_change_to_parent_id?' for #<Project:0x00007fe5c80586f0>):
  app/models/project.rb:83:in `block in <class:Project>'
  app/controllers/projects_controller.rb:187:in `update'

NoMethodError (undefined method `saved_change_to_sharing?' for
#<Version:0x00007fe5c88d8870> Did you mean?  saved_attachments):
  app/models/version.rb:371:in `update_issues_from_sharing_change'
  app/controllers/versions_controller.rb:125:in `update'
  lib/redmine/sudo_mode.rb:63:in `sudo_mode'

我想出来怎么解决了'undefined method'!

首先,检查 'undefined method' 是否存在并正确引用。有时源文件可能会丢失。

其次,如果'undefined method'是Rails方法(你可以搜索),检查搜索到的方法是否与当前Redmine的Rails版本兼容。

我发现 public_compute_asset_path 存在于 Rails 版本 5 中。 我当前的 Redmine 的 Rails 版本设置为 4,Rails 4 使用 asset_path 而不是 public_compute_asset_path

因此,我将 Redmine 的 rails 版本更改为 Rails 5.1.2,而且效果很好。

我的好奇心是 Redmine 官方网站指示使用 Rails 4.2 for Redmine 3.4,但它适用于 Rails 5.1...