TextMate command to display ActiveRecord model attributes

I’ve written a TextMate command bundle that reminds you the database
columns of an ActiveRecord model displaying them in a tooltip just by
selecting the model name (for example “Account”) anywhere in your
code and hooking up the bundle (the way you’ve chosen in the bundle
properties).

It’s available here:
http://roman2k.free.fr/rails/tm_show_model_attributes/0.1.0/
tm_show_model_attributes.rb

It’s greatly inspired from this blog entry by Chris R.:
http://blog.seagul.co.uk/articles/2006/07/14/textmate-command-to-
display-active-record-column-attributes

“Yeah but why should I use your version instead?”
The advantages of mine over Chris’es are:

  • Fast load-time before displaying the tooltip. Almost instant actually:
    • only loads useful files and parts of the configuration (whereas
      the other version loads the full Rails environment),
  • Cleverly looks for the model file:
    • the model class can be nested within modules, for example:
      “MyBusiness::Person”
    • the model file is guessed to be “app/models/my_business/
      person.rb”, then “app/models/my_business.rb” until it’s found,
  • Fixes the bug that non-ActiveRecord classes aren’t recognized,
  • More efficient algorithm.

Chris’es post explains how to install it into your TextMate, so go
ahead and read it :slight_smile: However, in order to use my version of the
command, use the Ruby code available at the first URL at the top of
this message.

I’ve tested it working but maybe not deeply enough so don’t hesitate
to make a remark or issue any bug. I’d be pleased to respectively
read or fix it.

-Roman

Oops, read " Chris’ " and not " Chris’es ". I’m sorry.