TodoList: scaffold について調べる2006年12月11日 15時00分59秒

今度は、検索機能を付けたい。検索機能は以前に実験した事がある。

まずは、http://localhost:3000/todo/list から、検索ページに行けるようにする。まだ、app/views/todo/list.rhtml は存在しないので、作る必要がある。

Ruby on Rails 〜レールの路線図〜 には

$ script/generate scaffold <モデル名> [<コントローラ名>] [<アクション>, ...]
とある。TodoListTutorialにあったのは、
$ ruby script/generate scaffold Todo
の形だ。アクションを指定しないと、全ての物が作られるという事だろうか。

今回は、list のみ作りたいので試してみる。


% ruby script/generate scaffold Todo list
      exists  app/controllers/
      exists  app/helpers/
      create  app/views/list
      exists  test/functional/
  dependency  model
      exists    app/models/
      exists    test/unit/
      exists    test/fixtures/
   identical    app/models/todo.rb
   identical    test/unit/todo_test.rb
   identical    test/fixtures/todos.yml
      create  app/views/list/_form.rhtml
      create  app/views/list/list.rhtml
      create  app/views/list/show.rhtml
      create  app/views/list/new.rhtml
      create  app/views/list/edit.rhtml
      create  app/controllers/list_controller.rb
      create  test/functional/list_controller_test.rb
      create  app/helpers/list_helper.rb
      create  app/views/layouts/list.rhtml
      create  public/stylesheets/scaffold.css

app/views/todo/list.rhtml を作りたかったのだが、どうも思っていたのと違うようだ。取り合えず、新しく出来てしまったファイルを消すことにする。


% ruby script/generate scaffold Todo 
      exists  app/controllers/
      exists  app/helpers/
      create  app/views/todos
      exists  test/functional/
  dependency  model
      exists    app/models/
      exists    test/unit/
      exists    test/fixtures/
   identical    app/models/todo.rb
   identical    test/unit/todo_test.rb
   identical    test/fixtures/todos.yml
      create  app/views/todos/_form.rhtml
      create  app/views/todos/list.rhtml
      create  app/views/todos/show.rhtml
      create  app/views/todos/new.rhtml
      create  app/views/todos/edit.rhtml
      create  app/controllers/todos_controller.rb
      create  test/functional/todos_controller_test.rb
      create  app/helpers/todos_helper.rb
      create  app/views/layouts/todos.rhtml
      create  public/stylesheets/scaffold.css

簡単に scaffold について調べてみたが、期待するような答えを見つけられなかった。

前回次回

コメント

コメントをどうぞ

※メールアドレスとURLの入力は必須ではありません。 入力されたメールアドレスは記事に反映されず、ブログの管理者のみが参照できます。

※なお、送られたコメントはブログの管理者が確認するまで公開されません。

名前:
メールアドレス:
URL:
コメント:

トラックバック

このエントリのトラックバックURL: http://uyota.asablo.jp/blog/2006/12/11/993319/tb

※なお、送られたトラックバックはブログの管理者が確認するまで公開されません。