2008-06-24

Depot Sample in Rails 2.0, Step 4

关键字: rails2.0 depot
Objective: To decorate HTML page 1. add some test data ruby script/generate migration add_test_data 2. edit db/migrate/*****_add_test_data.rb class AddTestData < ActiveRecord::Migration def self.up Product.delete_all Product.create(:title => 'Pragmatic Project Automation', ...
2008-06-24

Depot Sample in Rails 2.0, Step 3

关键字: rails2.0 depot
Objective: To add validation for product input 1. add validation for product class Product < ActiveRecord::Base validates_presence_of :title, :description, :image_url validates_numericality_of :price validate :price_must_be_at_least_a_cent validates_uniqueness ...
2008-06-24

Depot Sample in Rails 2.0, Step 2

关键字: rails2.0 depot
Objective: To add a new column in pre-built product 1. create a migration task: add a column for product ruby script/generate migration add_price 2. edit db/migrate/*****_add_price.rb class AddPrice < ActiveRecord::Migration def self.up add_column :products, :price, :decimal, :pre ...
2008-06-24

Depot Sample in Rails 2.0, Step 1

关键字: depot, rails2.0
Depot for MySQL5.0, Rails2.0 in WindowXP, # means comments, Hope you can enjoy it. Objective: To build the basic skeleton of depot 1. create depot rails project rails depot 2. edit config/database.yml development: adapter: mysql database: depot_development username: root password: ...
sam0411
搜索本博客
博客分类
最近加入圈子
最新评论