2

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'
ibocon
  • 1,352
  • 3
  • 17
  • 40
  • `undefined method ``public_compute_asset_path'` have you updated your `routes`. It seems like an routing-bug or an configuration-bug. Maybe it is an known-Issue http://www.redmine.org/boards/2/topics/48375 – amarradi Mar 23 '18 at 08:48
  • I searched about `public_compute_asset_path` on Rails API and I change `path = File.join(Rails.public_path, **public_compute_asset_path**("#{source}#{extname}", options))` to `path = File.join(Rails.public_path, **asset_path**("#{source}#{extname}", options))`. Now it looks like working, but I keep getting `NoMethodError (undefined method saved_change_to_sharing?' for #` and `NoMethodError (undefined method saved_change_to_parent_id? for #):` etc.... – ibocon Mar 23 '18 at 09:14
  • Redmine 3.4.4 is not compatible with Rails 5. Plugins are usually compatible with a specific version of Redmine, not a version of Rails. – Nanego Mar 23 '18 at 14:43

1 Answers1

0

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...

ibocon
  • 1,352
  • 3
  • 17
  • 40
  • Redmine always requires the exact Rails version specified in the `Gemfile` of its release. You should never have to change the `Gemfile` yourself. And if you do, all sorts of things can (and probably will) go wrong. – Holger Just Mar 26 '18 at 12:59
  • @HolgerJust I changed `Gemfile` because some gems are not corretly install on Mac OS. That is why I use Rails version 5.1.2 initially. But, the biggest issue was on file `config/initializers/10-patches.rb`, which using a method `public_compute_asset_path` in [Rails version 5](http://api.rubyonrails.org/classes/ActionView/Helpers/AssetUrlHelper.html#method-i-public_compute_asset_path). Rails 4 use [compute_asset_path](https://apidock.com/rails/v4.0.2/ActionView/Helpers/AssetUrlHelper/compute_asset_path) – ibocon Mar 27 '18 at 05:24