30秒でRails 2.0.2が試せるTodo Listサンプル
メモ。昨日の id:takahashim:20071222#p2 の続き。
とにかく今すぐRails 2.0系を触りたい人向けの手順。 http://robmayhew.com/rails-201-todo-list-tutorial/ をほぼそのまま(Rails2.0.2でsqlite3を使うときはrake db:create:allが不要っぽいので省略しただけ)。
手順のみ:
$ rails todo $ cd todo $ ruby script\generate scaffold Todo title:string body:text done:boolean due:datetime $ rake db:migrate $ ruby script\server
実行結果つき:
$ rails todo # ずらっといつものやつが出ます。昨日もやったので省略 $ cd todo $ ruby script\generate scaffold Todo title:string body:text done:boolean due:datetime exists app/models/ exists app/controllers/ exists app/helpers/ create app/views/todos exists app/views/layouts/ exists test/functional/ exists test/unit/ create app/views/todos/index.html.erb create app/views/todos/show.html.erb create app/views/todos/new.html.erb create app/views/todos/edit.html.erb create app/views/layouts/todos.html.erb create public/stylesheets/scaffold.css dependency model exists app/models/ exists test/unit/ exists test/fixtures/ create app/models/todo.rb create test/unit/todo_test.rb create test/fixtures/todos.yml create db/migrate create db/migrate/001_create_todos.rb create app/controllers/todos_controller.rb create test/functional/todos_controller_test.rb create app/helpers/todos_helper.rb route map.resources :todos $ rake db:migrate (in C:/InstantRails-2.0pr/rails_apps/todo) == 1 CreateTodos: migrating =========================== -- create_table(:todos) -> 0.0150s == 1 CreateTodos: migrated (0.0150s) ================== $ ruby script\server => Booting Mongrel (use 'script/server webrick' to force WEBrick) => Rails application starting on http://0.0.0.0:3000 => Call with -d to detach => Ctrl-C to shutdown server ** Starting Mongrel listening at 0.0.0.0:3000 ** Starting Rails with development environment... ** Rails loaded. ** Loading any Rails specific GemPlugins ** Signals ready. INT => stop (no restart). ** Mongrel 1.1.2 available at 0.0.0.0:3000 ** Use CTRL-C to stop.