Wednesday, January 26, 2005

Ultra simple Ruby on Rails tutorial

Assumptions are mysql is installed along with ruby and rails

In mysql:

createdb TEST;
create table TEST.test (id int key auto_increment, title varchar(10) not null);

Then execute:
rails test
cd test

Now update config/database.yml

ruby script/generate model test
ruby script/generate controller test

edit app/controllers/test_controller.rb:

class TestController <>

scaffold :test


Edit config/environment.rb:
ActiveRecord::Base.pluralize_table_names = false

Browse to:

BING, instant CRUD!

No comments: