Bug #ISSUE-12
No route matches error for journals#new
50%
Description
Before Rails 4 it was possible to override name routes in config/routes.rb
. But, in Rails 4 this is no longer possible, see source:config/routes.rb@21#L12.
For Rails 4.1 it was possible to override the path helper method by including a custom module as follows:
Rails.application.routes.url_helpers.send(:include, IssueRouterHelper)
But, in Rails 4.2 this does not work as well. Redmine gives the error:
No route matches {:action⇒“new”, :controller⇒“journals”, :id⇒#<Issue id: 273, ..., project_key: “ADMIN”, issue_number: 8>} missing required keys: [:id]
I tried different methods including something like (found such on StackOverflow):
Rails.application.routes.named_routes.url_helpers_module.send(:include, IssueRouterHelper)
But, no luck.
Currently, this is fixed by overriding app/views/issues/show.html.erb
(see r23), but this is not a good workaround. A better one should be found! I assume, Rails 4.3+ should have a fix for this.
Related issues
History
#1 Updated by Andriy Lesyuk about 8 years ago
- Related to Bug #ISSUE-8: Errors when used with redmine 3 added
#2 Updated by Andriy Lesyuk about 8 years ago
- Description updated (diff)
#3 Updated by Andriy Lesyuk almost 7 years ago
- Status changed from Incomplete to In Progress
- Target version set to 0.0.2
- Redmine version set to 3.3.x
Got this error again - in #render_notes. That’s because #render_notes now calls #quoted_issue_path.
#4 Updated by Andriy Lesyuk almost 7 years ago
- Priority changed from Normal to Major
#5 Updated by Andriy Lesyuk almost 7 years ago
- % Done changed from 0 to 50
#6 Updated by Andriy Lesyuk almost 7 years ago
- Status changed from In Progress to Deferred
- Target version deleted (
0.0.2)
This was fixed in 0.0.2, but I don’t like the way, it was fixed, so leaving this ticket open.
Currently, as it was mentioned above, it was fixed by overriding issues’ show.html.erb
and monkey-patching #render_notes
. The proper fix would be to override the route only, but this is not currently allowed by Rails, what, I believe, should change in future (maybe, in 4.3+).