Closed dmakurin closed 2 years ago
Turns out redmine actually supports ruby 3.0 (https://www.redmine.org/issues/34992). But compatibility for 2.7 would be great since it is still a maintainable version.
Just tested width Ruby 2.7 and it seems to be working.
# ruby -v
ruby 2.7.4p191 (2021-07-07 revision a21a3b7d23) [x86_64-linux-gnu]
Could you add some details to your problem, please? production.log, Ruby version, Redmine version,...
Well its actually working but there is no link to issue:
Problem is that block https://github.com/redmine/redmine/blob/2a60a7bd7940dcde74202163f36becf53df7f9b3/app/helpers/issues_helper.rb#L232 got nothing when you use &Proc.new{}
Tested on https://github.com/redmine/redmine/tree/5.0-stable
ruby 2.7.6p219 (2022-04-12 revision c9c2245c0a) [x86_64-linux]
Rails 6.1.6
Something like this would fix it:
diff --git a/lib/redmine_custom_workflows/patches/issue_relation_patch.rb b/lib/redmine_custom_workflows/patches/issue_relation_patch.rb
index 1e67623..d3daf70 100644
--- a/lib/redmine_custom_workflows/patches/issue_relation_patch.rb
+++ b/lib/redmine_custom_workflows/patches/issue_relation_patch.rb
@@ -36,7 +36,15 @@ module RedmineCustomWorkflows
alias_method :old_to_s, :to_s
def to_s(issue=nil)
- block_given? ? old_to_s(issue, &Proc.new {}) : old_to_s(issue)
+ if block_given?
+ if Gem.ruby_version < Gem::Version.new('3.0')
+ old_to_s(issue, &Proc.new)
+ else
+ old_to_s(issue, &Proc.new {})
+ end
+ else
+ old_to_s(issue)
+ end
rescue NoMethodError => e
if issue_from.present? || issue_to.present?
raise e
Very well. I've applied your patch. Could you test, the devel branch now, please?
P.S. A pull request next time, please.
Yeah, it works. Thank you.
I've just fixed it a bit more professionally. It should work in Ruby 2.7 and 3.0 too.
Yes it fixed error in ruby 3.0 but current redmine version does not use nor support ruby 3.0. You should at least provide backward compatibility.