August 19, 2007

Ruby Fun

Well I figured out a few things.

How to make a ruby app set up to use sqlite3

rails app-name -d sqlite3

How to properly install sqlite3's dll - put it in ruby/bin

How to check to see if you have a gem installed

gem list sqlite3

I am working towards a nice simple version of rails that will run on Windows and Mac from a USB stick.

On the Mac, I am happy with Locomotive. On Windows - I like InstantRails - but do not like MySql as the database.

The SQLite browser is dang cool and dang simple to install on both mac and PC.

http://sqlitebrowser.sourceforge.net/

Textmate is a very very fun editor for the Mac and Rails. It instant-installs right from Locomotive. Sweet.

On the PC - I like e-texteditor http://www.e-texteditor.com/

The dang sweetest thing so far is

After running

ruby script/generate model Thing

And making a simple database migration script like this:

class CreateThings < ActiveRecord::Migration
def self.up
create_table :things do |t|
t.column :key, :string
t.column :value, :string
end
end

def self.down
drop_table :things
end
end

Then run this:

ruby script/console

And type this:

x = Thing.new
x.key='123'
x.value = 'fred'
x.save

Absolutely sweet - able to interact with the ORM from the command line - dang dang dang. Hib can eat its heart out.

I still am confused as to why folks don't use SQLite3 all the time for simple stuff - like for teaching. These one-click installers should all use SQLite3 IMHO.

Also I wonder why people ever use anything other than migrations using the DB-independent syntax to populate/organize tables. Urg.

It is too bad that the ruby / rails stuff does not put consistent line-ends in place. Some things work in vi others fail in notepad.exe - ah well - a good reason to get a sweet editor like TextMate or e-texteditor - and pay for them.

TTFN - time to go buy some more 1GB USB sticks and a USB-2 controller.

Posted by csev at August 19, 2007 05:03 PM