Ruby Console to the Rescue


I hadn’t used Ruby console ever to test things out. That means lots of code tweaking and page refreshes to test things…not a good approach I know.

So I figured I’d fire up the console

$ cd /MyRails/AppDirectory/
$ ruby script/console

So from there I was able to test all kinds of silly stuff.  Like how to remove non digit characters from a string and leave only a number. I was able to test several different ways and it instantly tells me if my syntax is wrong and its quick and easy to fix a missing comma or something like that.

It was also very helpful testing out the GeoKit plugin for mapping and GeoCoding addresses.  After only 10 minutes instead of like an hour I was able to work out the syntax and get the thing working, w00t.

And this morning I needed to figure out how to combine a date and time from two separate user fields into one field stored in my silly silly MS SQL database.  And I did it in about 2 minutes instead of the normal 20 or so of fooling in my code and refreshing the page and building test pieces and then backing out the test pieces and getting distracted with another problem on the page and fumbling with syntax for 10 page reloads and and and….

All in all Ruby console to the rescue.


One thought on “Ruby Console to the Rescue

Leave a Reply

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

You are commenting using your 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