Finding Help Fast
As I mentioned in my previous post on Textmate shortcuts, keeping your train of thought while programming is really important. Searching through documentation to find a method name or the available parameters kills your train of thought. Recently, I have leveraged the sweetness of Firefox quick searches to help me in this matter. Watch the screencast linked below to see what I’m talking about and then read the rest of the post to learn how.
I continually forget the form helpers. Is it form_for, form_tag, checkbox_tag or check_box_tag? Oh, and don’t get me started on options_from_collection_for_select or whatever those methods are. Anyway…I discovered Ruby Search a while ago but didn’t really use it much at first. I’m a big time minimalist while I’m coding. I open only the apps that I need and I try to keep my tabs to 3 or 4 in my browser. Having an entire tab devoted to some search engine is out of the question. What I like to do is open a new tab, search the docs and close the tab so that I can remain in my wonderfully minimalistic tabdom.
You may or may not know this but Firefox can associate keywords with bookmarks and it even allows passing in parameters which can be used as search terms in a bookmark query string.
Searching Rails API and Caboo.se Edge Cracked Docs
I combined the search results of Ruby search with the keyword bookmark searches to create a quick and easy way of me searching the rails api docs, caboo.se’s edge cracked docs and the pickaxe all in one swoop.
Just create a new bookmark in firefox named ruby search. Make it’s keyword ‘ruby’ and set the location to:
Now I can type, ‘ruby form_for’ or ‘ruby link_to’ and instantly have links to the docs. Very handy.
Searching Ruby Core Classes
The only problem with the ruby search is that it doesn’t search the ruby core classes (or at least doesn’t work if it does). Knowing that, I made another bookmark named ‘Ruby Core Docs’, with a keyword of ‘core’ and a location of:
Array, String and Hash are a few classes that I lookup multiple times in a day. Using the previous keyword bookmark, I can simply type ‘core String’ in the browser url bar and I’m taken straight to the ruby core docs for String.
Hope you find these shortcuts as useful as I do and that they boost your Rails efficiency. I’m hoping to start using screencasts a bit more as I think they can really be effective in learning new techniques. Maybe I’ll even talk on the next one. :)