25 Sep 2005, 19:35
Tags:
Comments Off

Starting with Ruby on Rails

Ok, so I’ve been doing some setup in the last few days (just every once in a while, usually no longer than 15 minutes in a row) to get Ruby on Rails running. Since Bart really likes the concept, I wanted to give it a try. Setting the stuff up wasn’t really difficult, most Ruby on Rails tutorials give you a lot of hints about getting set up. Just a note, to try it “full fledged”, I’ve even set up three different databases; one for production, one for testing and one for development.

I started very simple with an accounts table, like so:

CREATE TABLE `accounts` (
`user_id` VARCHAR( 25 ) NOT NULL ,
`fullname` VARCHAR( 50 ) ,
`email` VARCHAR( 50 ) NOT NULL ,
PRIMARY KEY ( `user_id` )
) TYPE = MYISAM COMMENT = 'The accounts of the website users';

Then in the website root, I typed script/generate scaffold accounts. I tried looking at http://myserver:3000/accounts to see the results, but alas, I got an error. From this tutorial I ‘stole’ the following idea: script/generate model account. Now http://myserver:3000/accounts seems to display something. I can create a new account, but it stubornly leaves out the user_id field. I think I’ve seen in this movies that it’s supposed to behave that way, since fields ending in ‘_id’ are primary keys and supposed to be left out. So I redesigned my first table as follows:

CREATE TABLE `accounts` (
`user_id` smallint(6) NOT NULL auto_increment,
`username` varchar(25) NOT NULL default '',
`fullname` varchar(50) default NULL,
`email` varchar(50) NOT NULL default '',
PRIMARY KEY (`user_id`),
UNIQUE KEY `username` (`username`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1 COMMENT='The accounts of the website users' ;

Now I rerun script/generate scaffold accounts and answer ‘Y’ (the default) on all questions. Now things look good, I get a view in which I can insert a new account. Nice. So far, so good.

Now the difficult part, I need to build a website out of this and at the same time learn to use Ruby, the programming language. I think it’ll take about 3 months or so to get me really running. But I’ll be taking small steps and work my way through it. Bart suggested I’d look at the Ruby on Rails API documentation, which although probably very thorough, is very difficult to read. But I’ll learn.

I’m content for today. Will look at this again tomorrow. Or tonight ;-)

Tags:

25 Sep 2005, 18:50

Comments Off

Ubuntu Breezy: X not working

I just did an update of my desktop, which is running Ubuntu “Breezy Badger” (5.10) and it appears Xorg is broken. It’s fixed quite easily by manually installing it with apt-get install xserver-xorg and if you need it, a dpkg-reconfigure xserver-xorg.

 
  • Search


  • Calender

    September 2005
    M T W T F S S
    « Aug   Oct »
     1234
    567891011
    12131415161718
    19202122232425
    2627282930  
  • Twitter

    Powered by Twitter Tools

  • RSS Delicious feed

  • Archives