Is there a way to tweak routes outside of routes.rb?
Added by Beau Simensen about 14 years ago
I am starting to learn how to tweak my routes.rb but am hoping to find a way to make changes to the routing outside of routes.rb since routes.rb is a part of the Redmine package itself. Because routes.rb is in the Redmine package itself, modifications to this file (and I'll be modifying it for several installs) show up as being "modified."
# modified: config/routes.rb
What is the best way to handle these types of changes? I don't want to maintain a separate fork for each installation if it can be helped.
Replies (6)
RE: Is there a way to tweak routes outside of routes.rb? - Added by Beau Simensen about 14 years ago
Any ideas here? I feel like I could probably implement something whereby an optional configuration file could be included before the standard routes and then after the standard routes ( to do pre and post configuration ) and add them to the repository "ignore" files, but this would definitely require me to fork the Redmine codebase.
If I implemented this and I submitted patches would this be something that might be considered to be added into Redmine in a future release?
RE: Is there a way to tweak routes outside of routes.rb? - Added by Felix Schäfer about 14 years ago
Why not put the routes (and whatever changes mandate those new routes) in a plugin?
RE: Is there a way to tweak routes outside of routes.rb? - Added by Beau Simensen about 14 years ago
How would that work, exactly? If I could figure out how to update the routes from a plugin I'd be all over it!
I'm new to Redmine (and Rails, for that matter) so this might be obvious but I'm lost. I did a quick search on the following Plugin related pages and I don't see anything about routes listed with the exception of the test section in the Plugin tutorial.
- A step-by-step tutorial on writing a Redmine plugin
- A description of the internal handling of Redmine plugins
- A description of the Redmine plugin hooks API
- An incomplete list of available Redmine plugin hooks
I just found this post suggesting how this might be done, but I think this was prior to implementation. Are there docs for how to do this? Or would you recommend any cleanly written plugins that do this?
RE: Is there a way to tweak routes outside of routes.rb? - Added by Felix Schäfer about 14 years ago
Add your routes to the routes file of the plugin (config/routes.rb
). Rereading what you've written I'm not sure if that's what you are looking for though: you can extend routes from a plugin, not modify them.
RE: Is there a way to tweak routes outside of routes.rb? - Added by Beau Simensen about 14 years ago
Hm, OK. The main use case I have is that I want to override the map.home route like this:
# map.home '', :controller => 'welcome' map.home '', :controller => 'projects', :action => 'show', :id => 'my_default_project'
If I could make this into a plugin, I could list the projects and let the administrator choose the default project. Are you saying there is currently no way for a plugin to make this type of change?
RE: Is there a way to tweak routes outside of routes.rb? - Added by Felix Schäfer about 14 years ago
IIRC the routes from the plugins get loaded after the core ones, but I'm not sure. Just try it out :-)