0. 디렉토리 생성
% rails -d mysql mugame
1. 일단 db 만들기
% ./script/generate migration create_user_table
2. 생성된 파일 열고 에디트
class CreateUserTable < ActiveRecord::Migration
def self.up
create_table :userTBL do |t|
t.string :user_id
t.string :password
t.string :email
t.timestamps
end
end
def self.down
drop_table :userTBL
end
end
3. DB 실제 테이블 생성
% rake db:migrate
4. app/model/users.rb 생성
5. app/controller/users_controller.rb 만들고 edit
==> 파일명 주의
def index
end
추가
6. app/view/users/index.html.erb 생성
'Ruby Sucks' 추가
7. script/server start
댓글 없음:
댓글 쓰기