Wednesday, March 19, 2008

Updating locate on Mac OSX

Update locatedb on your Mac OSX with:
sudo /usr/libexec/locate.updatedb

Tuesday, March 11, 2008

Debugging ruby rails in production

Helpful little thing that helped me debug my ruby rails production system.

shell$ [RAILS_ROOT]/script/console production

So here you can invoke a model (e.g. User.new), call helper methods (UserHelper.authenticate(user, pass)), etc.

Thursday, March 6, 2008

Ruby Rails column type to MySQL datatype

lifted from PackT.

Migration column type...

Converts to MySQL field type...

Available options1

:binary

TINYBLOB, BLOB, MEDIUMBLOB, or LONGBLOB2

:limit => 1 to 4294967296 (default = 65536)2

:boolean

TINYINT(1)

-

:date

DATE

-

:datetime

DATETIME

-

:decimal

DECIMAL

:precision => 1 to 63 (default = 10) :scale => 0 to 30 (default = 0)3

:float

FLOAT

-

:integer

INT

:limit => 1 to 11 (default = 11)

:primary_key

INT(11) AUTO_INCREMENT PRIMARY KEY

-

:string

VARCHAR

:limit => 1 to 255 (default = 255)

:text

TINYTEXT, TEXT, MEDIUMTEXT, or LONGTEXT2

:limit => 1 to 4294967296 (default = 65536)2

:time

TIME

-

:timestamp

DATETIME

-

Tuesday, March 4, 2008

Production Rails Database

To make a production version of a database defined in rails.

rake db:migrate RAILS_ENV="production"

Monday, March 3, 2008

phpMyAdmin plug

Man... gotta use phpMyAdmin for looking at your MySQL database. On Mac use 'Fink Commander' and look for phpMyAdmin. Follow the configuration instructions here. In order for me to get it working, I had to set the following properties:

$cfg['Servers'][$i]['socket'] = '/tmp/mysql.sock';
$cfg['Servers'][$i]['connect_type'] = 'socket';