Rails-routes.tmbundle is a project mainly written in Ruby, it's free.
A TextMate bundle with a couple of navigation functions for Rails' named routes: go to action, view etc.
This is a {TextMate}[http://macromates.com/] bundle that provides a couple of functions for working with {Ruby on Rails}[http://rubyonrails.org/]' {named routes}[http://guides.rubyonrails.org/routing.html]. The functions currently are:
Cmd-P
Ctrl-Cmd-P
Opt-Cmd-P
routes.rb
-- Ctrl-Opt-Cmd-R
= Usage
If the selected text (or word under cursor) looks like a named route expression in your controller or view code, e.g:
edit_user_path(@user) root_path post_comment_url(@post, @comment) new_publisher_magazine_photo_url
you can press Cmd-P
to go to the action or view associated with this route (the choices are presented in a popup menu). You can also press Opt-Cmd-P
to go directly to the view file or Ctrl-Cmd-P
to go directly to the action.
= Installation
mkdir -p ~/Library/Application\ Support/TextMate/Bundles cd ~/Library/Application\ Support/TextMate/Bundles git clone git://github.com/szeryf/rails-routes.tmbundle.git osascript -e 'tell app "TextMate" to reload bundles'
= Troubleshooting
Normally when you press any of the shortcuts, you should see a progress bar saying "Loading routes.rb" for a moment (exactly how long depends on your project and routes.rb
size). If it says "Loading environment.rb" instead and stays considerably longer, there may be a problem with your routes.rb
depending on something that is loaded by environment.rb
file (in one of my projects it was a config class). So, if you want to speed up these operations, make sure that your routes.rb
can be require
d without require
ing environment.rb
first (which takes notoriously long in most Rails projects).
To check this, run irb
(NOT script/console
) in your project directory and try issuing the following:
require 'config/boot.rb' => true require 'action_controller' => true require 'config/routes.rb' => []
If this goes without errors, you should be good to go. If you get some errors, there is something missing for routes.rb
. You'll have to examine those errors and fix them if possible.
= Compatibility
Tested with Rails 2.3.5. Should work with any Rails 2.x version (if it doesn't let me know). May not work with Rails 3 (I haven't tested it) but patches welcome.
= To do
routes.rb