ruby-on-railsredminewebrick

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


I try to change Ruby version from 2.5.0 to 2.4.1 and Rails version from 5.1.2 to 4.2.1 because of applying plugin.

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

I am new to Ruby on Rails.. What should I do here?

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'

Solution

  • I figure it out how to solve 'undefined method'!

    First, check 'undefined method' is exist and referenced correctly. Sometimes source file could be missing.

    Second, if 'undefined method' is Rails method (you can search), check searched method is compatible with current Redmine's Rails version.

    I figure out public_compute_asset_path is exist in Rails version 5. My current Redmine's Rails version set to 4 and Rails 4 use asset_path instead public_compute_asset_path.

    Therefore, I changed my rails version for Redmine to Rails 5.1.2 and it works charming.

    My curiosity is official Redmine site instruct to use Rails 4.2 for Redmine 3.4, but it works with Rails 5.1...