2013/03/31

Rails Scaffold

generateしたらやること

 # rake db:migrate

config/database.ymlを編集
 development:
  adapter: sqlite3
  database: db/development.sqlite3
  pool: 5
  encoding: utf8 <-- 追記
  timeout: 5000

public/index.htmlを削除

config/routes.rbを編集

Bookshelf::Application.routes.draw do
  root :to => 'books#index' <-- 追記
  resources :books
end

 # rake routes
      root        /                         books#index <-- これを確認
    books GET    /books(.:format)          books#index
          POST   /books(.:format)          books#create
 new_book GET    /books/new(.:format)      books#new
edit_book GET    /books/:id/edit(.:format) books#edit
     book GET    /books/:id(.:format)      books#show
          PUT    /books/:id(.:format)      books#update
          DELETE /books/:id(.:format)      books#destroy

0 件のコメント:

コメントを投稿