16
~ ダウンロードからScaffoldまで ~ http://instantrails.rubyforge.org/wiki/wiki.pl?Instant_Rails

InstantRails how to

Embed Size (px)

DESCRIPTION

2007/08/11 ワイズノット社内勉強会

Citation preview

Page 1: InstantRails how to

~ ダウンロードからScaffoldまで ~

http://instantrails.rubyforge.org/wiki/wiki.pl?Instant_Rails

Page 2: InstantRails how to

ダウンロード

http://rubyforge.org/frs/?group_id=904

InstantRails-1.7-win.zip

Page 3: InstantRails how to

インストール

ダウンロードしたファイルを展開(パスにスペースを含まないように)

Page 4: InstantRails how to

hosts設定

127.0.0.1       localhost

127.0.0.1       mybookshelf

最終行に追加

Page 5: InstantRails how to

アプリケーション作成(1/2)

Page 6: InstantRails how to

アプリケーション作成(2/2)C:¥InstantRails¥rails_apps>rails mybookshelf

createcreate  app/controllerscreate  app/helpers...create  log/production.logcreate  log/development.logcreate  log/test.log

C:¥InstantRails¥rails_apps>

Page 7: InstantRails how to

確認

Page 8: InstantRails how to

データベース作成

mybookshelf_development

Page 9: InstantRails how to

ユーザ作成

mybookshelfpass

Page 10: InstantRails how to

ユーザ特権設定

Page 11: InstantRails how to

データベース接続設定

# And be sure to use new‐style password hashing:#   http://dev.mysql.com/doc/refman/5.0/en/old‐client.htmldevelopment:

adapter: mysqldatabase: mybookshelf_developmentusername: mybookshelfpassword: mybookshelfpasshost: localhostencode: utf8

# Warning: The database defined as 'test' will be erased and

C:¥InstantRails¥rails_apps¥mybookshelf¥config¥database.yml

Page 12: InstantRails how to

モデル作成C:¥InstantRails¥rails_apps¥mybookshelf>ruby script¥generate→ model Book isbn:string title:string review:text

exists  app/models/exists  test/unit/exists  test/fixtures/create  app/models/book.rbcreate  test/unit/book_test.rbcreate  test/fixtures/books.ymlcreate  db/migratecreate  db/migrate/001_create_books.rb

C:¥InstantRails¥rails_apps¥mybookshelf>

1行で

Page 13: InstantRails how to

テーブル作成C:¥InstantRails¥rails_apps¥mybookshelf>rake db:migrate(in C:/InstantRails/rails_apps/mybookshelf)== CreateBooks: migrating =================================‐‐ create_table(:books)

‐> 0.0400s== CreateBooks: migrated (0.0400s) ========================

C:¥InstantRails¥rails_apps¥mybookshelf>

Page 14: InstantRails how to

Scaffold作成C:¥InstantRails¥rails_apps¥mybookshelf>ruby script¥generate→ scaffold Book

exists  app/controllers/exists  app/helpers/create  app/views/books...create  app/helpers/books_helper.rbcreate  app/views/layouts/books.rhtmlcreate  public/stylesheets/scaffold.css

C:¥InstantRails¥rails_apps¥mybookshelf>

1行で

Page 15: InstantRails how to

Mongrel起動

Page 16: InstantRails how to

完成!!