Open lmorillas opened 4 years ago
I am running on the same Rails version as you and never encountered this error. alias_method_chain
was only deprecated, not removed, in Rails 5, as described in their changelog. It seems your issue is more complicated than that.
Environment:
Redmine version 4.1.1.stable
Ruby version 2.5.8-p224 (2020-03-31) [x86_64-linux-gnu]
Rails version 5.2.4.2
Environment production
Database adapter Mysql2
Mailer queue ActiveJob::QueueAdapters::AsyncAdapter
Mailer delivery smtp
SCM:
Subversion 1.9.7
Git 2.17.1
Filesystem
Xitolite 2.17.1
Redmine plugins:
additionals 2.0.23
redmine_git_hosting 4.0.0
redmine_github_hook 3.0.1
redmine_tags 4.0.0
No, I think latest 5.2 stable removed alias_method_chain
I finally installed using alias_method at api_template_handler_patch.rb
class << self
alias_method :call_without_redmine_tags, :call
alias_method :call, :call_with_redmine_tags
end
But now I'm gettins issues with /projects.json API endpoint when other plugins installed (Tested with redmine_canned_respneses)
App 17103 output: I, [2020-09-13T06:32:07.833207 #17103] INFO -- : Started GET "/projects.json" for 83.38.157.49 at 2020-09-13 06:32:07 +0000
App 17103 output: I, [2020-09-13T06:32:07.834043 #17103] INFO -- : Processing by ProjectsController#index as JSON
App 17103 output: I, [2020-09-13T06:32:07.838023 #17103] INFO -- : Current user: admin (id=1)
App 17103 output: I, [2020-09-13T06:32:07.843417 #17103] INFO -- : Rendering projects/index.api.rsb
App 17103 output: I, [2020-09-13T06:32:07.891674 #17103] INFO -- : Rendered projects/index.api.rsb (48.2ms)
App 17103 output: I, [2020-09-13T06:32:07.891811 #17103] INFO -- : Completed 500 Internal Server Error in 58ms (ActiveRecord: 3.1ms)
App 17103 output: F, [2020-09-13T06:32:07.892863 #17103] FATAL -- :
App 17103 output: F, [2020-09-13T06:32:07.892889 #17103] FATAL -- : ActionView::Template::Error (undefined method `render_api_redmine_tags' for #<#<Class:0x0000562b03b22238>:0x0000562b032142e0>
App 17103 output: Did you mean? render_api_includes):
App 17103 output: F, [2020-09-13T06:32:07.892943 #17103] FATAL -- : 13: render_api_custom_values project.visible_custom_field_values, api
App 17103 output: 14: render_api_includes(project, api)
App 17103 output: 15:
App 17103 output: 16: api.created_on project.created_on
App 17103 output: 17: api.updated_on project.updated_on
App 17103 output: 18: end
App 17103 output: 19: end
App 17103 output: F, [2020-09-13T06:32:07.892959 #17103] FATAL -- :
App 17103 output: F, [2020-09-13T06:32:07.892969 #17103] FATAL -- : app/views/projects/index.api.rsb:16:in `block (4 levels) in _27171045b848e14f069ad3d26d5c29f7'
App 17103 output: lib/redmine/views/builders/structure.rb:74:in `method_missing'
App 17103 output: app/views/projects/index.api.rsb:3:in `block (3 levels) in _27171045b848e14f069ad3d26d5c29f7'
App 17103 output: app/views/projects/index.api.rsb:2:in `each'
App 17103 output: app/views/projects/index.api.rsb:2:in `block (2 levels) in _27171045b848e14f069ad3d26d5c29f7'
App 17103 output: lib/redmine/views/builders/structure.rb:35:in `array'
App 17103 output: app/views/projects/index.api.rsb:1:in `block in _27171045b848e14f069ad3d26d5c29f7'
App 17103 output: lib/redmine/views/builders.rb:36:in `for'
App 17103 output: app/views/projects/index.api.rsb:1:in `_27171045b848e14f069ad3d26d5c29f7'
Environment:
Redmine version 4.0.0.stable
Ruby version 2.5.3-p105 (2018-10-18) [x86_64-linux]
Rails version 5.2.2
Environment production
Database adapter Mysql2
i run into the same problem with Rails version 5.2.2 and intstalled alias_method, too which works fine. Now, i got a 500 too:
redmine_1 | I, [2020-09-24T07:51:15.208839 #1] INFO -- : Completed 500 Internal Server Error in 300ms (ActiveRecord: 167.6ms)
redmine_1 | F, [2020-09-24T07:51:15.209648 #1] FATAL -- :
redmine_1 | F, [2020-09-24T07:51:15.209665 #1] FATAL -- : ActionView::Template::Error (undefined method `with_indifferent_access' for #<ActionController::Parameters:0x00007f850071d478>):
redmine_1 | F, [2020-09-24T07:51:15.209717 #1] FATAL -- : 1: <% if defined?(sidebar_tags) && !sidebar_tags.empty? && !@issue %>
redmine_1 | 2: <%= stylesheet_link_tag 'jquery.tagit.css', plugin: 'redmine_tags' %>
redmine_1 | 3: <%= stylesheet_link_tag 'redmine_tags', plugin: 'redmine_tags' %>
redmine_1 | 4: <h3><%= l :tags %></h3>
redmine_1 | F, [2020-09-24T07:51:15.209726 #1] FATAL -- :
redmine_1 | F, [2020-09-24T07:51:15.209736 #1] FATAL -- : plugins/redmine_tags/lib/redmine_tags.rb:3:in `new'
redmine_1 | plugins/redmine_tags/lib/redmine_tags.rb:3:in `settings'
redmine_1 | plugins/redmine_tags/app/helpers/issues_tags_helper.rb:5:in `sidebar_tags'
redmine_1 | plugins/redmine_tags/app/views/issues/_tags_sidebar.html.erb:1:in `_plugins_redmine_tags_app_views_issues__tags_sidebar_html_erb___962827645735237273_47177192657560'
redmine_1 | lib/redmine/hook/view_listener.rb:59:in `block (2 levels) in render_on'
redmine_1 | lib/redmine/hook/view_listener.rb:57:in `map'
redmine_1 | lib/redmine/hook/view_listener.rb:57:in `block in render_on'
My Problem is solved here: https://github.com/ixti/redmine_tags/issues/208. Sorry!
greets
As mentioned by @lmorillas
class << self
alias_method :call_without_redmine_tags, :call
alias_method :call, :call_with_redmine_tags
end
Can confirm, this solves the problems when you have no previous version of redmine_tags
installed.
Also confirmed: If you have a previous installation of redmine_tags
please refer to #208.
Install raises a
` because of Rails 5
How to bypass that alias_method_chain ?
NoMethodError: undefined method
alias_method_chain' for #