블로그 이미지
언제나 늘 푸른 소나무처럼. 자신의 의지로 오롯이 서기
예섬수진

공지사항

최근에 올라온 글

최근에 달린 댓글

최근에 받은 트랙백

글 보관함

calendar

1 2 3 4 5 6
7 8 9 10 11 12 13
14 15 16 17 18 19 20
21 22 23 24 25 26 27
28 29 30

rails를 이용한 Web Application 만들기

2009. 12. 6. 16:40 | Posted by 예섬수진

1. rails를 이용한 기본 프로젝트 생성
rails blog

2. SQLite3 설치 (on Win32)
  1) cd blog (in cmd prompt)

  2) http://www.sqlite.org/download.html 에서 Precompiled Binaries For Windows에서 sqlitedll.zip Download. 
 
  3) 압축 해제 후, 2개의 파일(def, dll)을 ruby 설치 폴더\bin이나 c:\Windows\System32에 복사함
     ※ http://www.skorks.com/2009/08/installing-and-using-sqlite-with-ruby-on-windows/

  4) gem install sqlite3-ruby --include-dependencies

3. blog 프로젝트를 위한 DB 생성
   - cd blog
   - rake db:create

4. "Hello, Worlds" 출력
    1) ruby script/generate controller home index

    2) blog 폴더 내 app\views\home\index.html.erb 파일에서 내용을 지우고 다음과 같이 적임
      <h1>hello, world</h1>

    3) Web Server의 실행을 위해, 다음을 입력함
        ruby script/server

    4) In Web browser, 주소창에 http://localhost:3000/home/index를 입력하면 "hello, world"가 보임

5. Default Page 대신 "hello, world" Page 보여 주기
    1) rm public/index.html

    2) Open config\routes.rb using a edit program, write following 1st line
      map.root :controller => "home"
      map.connect ':controller/:action/:id'
      map.connect ':controller/:action/:id.:format'

      * routes.rb : tells Rails how to connect incoming request to controllers and actions.

    3) In web-browser, 주소창에 http://localhost:3000를 입력하면 "hello, world"가 보임