Defect #36896
closed
Errors on render details via IssuesHelper.details_to_strings
Added by VITALIY SAVCHENKO over 2 years ago.
Updated over 2 years ago.
Description
I have two errors on manual render details via IssuesHelper.details_to_strings
First on render attachments changes in issue:
2: from /usr/src/redmine/app/helpers/issues_helper.rb:494:in `block in details_to_strings'
1: from /usr/src/redmine/app/helpers/issues_helper.rb:602:in `show_detail'
/usr/src/redmine/app/helpers/application_helper.rb:126:in `link_to_attachment': undefined method `attachment_url' for #<#<Class:0x0000558479c80de0>:0x0000558479c80ae8> (NoMethodError)
Second on render custom field(type=text) changes:
1: from /usr/src/redmine/app/helpers/issues_helper.rb:494:in `block in details_to_strings'
/usr/src/redmine/app/helpers/issues_helper.rb:620:in `show_detail': undefined method `diff_journal_url' for #<#<Class:0x00005644a8e5db28>:0x00005644a8e5ca70> (NoMethodError)
Methods attachment_url and diff_journal_url not found in redmine github repo
- Status changed from New to Needs feedback
Both the attachment_url
and diff_journal_url
methods are dynamically created based on Redmine's URL routing rules to create the full URL to a object. Both of these methods should be available in every rendering context (i.e. within controllers, views and helpers).
To be able to find what went wrong here, it is however required that you show the full stack trace of the error. Please also make sure to run Redmine in production mode by setting RAILS_ENV=production
and restart your Redmine applciatiopn server after any change to Redmine's code, any plugin or configuration files on your server.
I use docker image.
issues2chat.rb - script that run via cmd
ruby ./scripts/issues2chat.rb
issues2chat.rb looks like
require "/usr/src/redmine/config/environment"
puts ENV["RAILS_ENV"] // print production
...
helper = Class.new.send(:include, IssuesHelper, ActionView::Helpers::TagHelper, ERB::Util, Redmine::I18n).new
helper.set_language_if_valid('ru')
description_text = helper.details_to_strings(journal.details).join("<br />") + "<br />" + description_text // line 54
...
5: from ./scripts/issues2chat.rb:54:in `block in <main>'
4: from /usr/src/redmine/app/helpers/issues_helper.rb:480:in `details_to_strings'
3: from /usr/local/bundle/gems/activerecord-5.2.6.3/lib/active_record/relation/delegation.rb:71:in `each'
2: from /usr/local/bundle/gems/activerecord-5.2.6.3/lib/active_record/relation/delegation.rb:71:in `each'
1: from /usr/src/redmine/app/helpers/issues_helper.rb:494:in `block in details_to_strings'
/usr/src/redmine/app/helpers/issues_helper.rb:620:in `show_detail': undefined method `diff_journal_url' for #<#<Class:0x0000562d0f37e640>:0x0000562d0f37e348> (NoMethodError)
I think this is a problem with your issues2chat.rb, not with Redmine itself. Please use forums for questions.
I can't find where these methods are defined
Resolved by define_method in script.
define_method(:diff_journal_url)...
define_method(:attachment_url))...
Can be closed
- Status changed from Needs feedback to Closed
- Resolution set to Invalid
Thank you for your feedback. Closing.
Also available in: Atom
PDF