Forum: Ruby on Rails TextMate command to display ActiveRecord model attributes

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
Bca6763730989267ae5c7cfa6503e177?d=identicon&s=25 Roman LE NEGRATE (Guest)
on 2006-12-25 18:21
(Received via mailing list)
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 Roos:
http://blog.seagul.co.uk/articles/2006/07/14/textm...
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 :-) 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
Bca6763730989267ae5c7cfa6503e177?d=identicon&s=25 unknown (Guest)
on 2006-12-25 21:46
(Received via mailing list)
Oops, read " Chris' " and not " Chris'es ". I'm sorry.
This topic is locked and can not be replied to.