Tuesday, December 30, 2008

DEPOT

Damn, my Sony mobile phone can't work in SMSD mode. So I'll abandon this project until I buy a proper GSM Modem.

So now, I'm reading Pragmatic Agile Web Development with RoR. The book is written for Rails 1.2 and I'm using the latest Rails 2.2.2

I'm using InstantRails on Windows Vista
#in c:\ror\rails_app\depot

-----------------------------------------Depot ---------------------------
# to create depot project
ruby rails depot -d mysql

# to create the products model
ruby script/generate model product

# edit the migration file db/migration/xxxx

class CreateProducts < ActiveRecord::Migration
def self.up
create_table :products do |t|
t.column :title, :string
t.column :description, :text
t.column :image_url, :string
end
end

def self.down
drop_table :products
end
end


#save the file and run db:migrate
rake db:migrate

# we need admin function to control the product
# we need to create admin controller
ruby script/generate controller admin


...to be continued...seems my ror 2.2.2 is not compatibe with my current RoR Ebook

1 comment:

  1. I recently bought this book too. Just wanted to say the latest Rails is 2.3.5.

    ReplyDelete