exceptionz

Thoughts on Technology, Methodology and Programming.

TextMate command to annotate your current ActiveRecord Model with the DB Schema

Posted by Marcus Wyatt on 18 March 2008

Edit: If you can’t wait until the end, here is the download link.

Who hasn’t used the Annotate Models plugin written by Dave Thomas, of Rails Pragmatic Studio fame? If you haven’t don’t fret… The plugin basically adds a comment block to the top of all of your model classes documenting the current database schema for the given model. I like to have the info in my model files to make it a little easier to work with models.

Annotated Models Plugin

The rails bundle within TextMate gives you a ‘Show DB Schema for current class’ command you can press to show a tool tip with the database schema (Control + Shift + Command + S). This works great, but I find the command sequence to long and the slight wait to see the schema info breaks my rhythm.

Show DB Schema for Current Class

To solve the problem I made a copy of the source files used by the command and modified it slightly to output the info as comments at the top of the file. Now I have nicely annotated model files. This is a real time saver.

Annotated Models Bundles

The bundle also contain the the Beautify command. This command adds automatic code formatting capability for your ruby code. I found the beautify command from Tim Burks. Cheers Tim…

You can download the bundle here.

Technorati Tags: , , , ,

Blogged from TextMate

About these ads

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

 
Follow

Get every new post delivered to your Inbox.

%d bloggers like this: