Instant Rails-2.0で"ruby script\generate scaffold"してもフィールドなしの画面しか出来ない
ここやここで調べて別にInstant Rails-2.0のせいではないと判ったのですが、Rails 2.0のscaffoldの振る舞いが変わったようでブラウザ画面で表示・編集したいフィールドは明示的に指定しないといけなくなったようです。
WEB+DB PRESS Vol.32の連載Ruby on Rails Wayの第1回の例だとこうなります。
C:\Tools\InstantRails-2.0\rails_apps\demo>ruby script\generate scaffold Recipe title:string description:string written_on:date instructions:text exists app/models/ exists app/controllers/ exists app/helpers/ create app/views/recipes exists app/views/layouts/ exists test/functional/ exists test/unit/ create app/views/recipes/index.html.erb create app/views/recipes/show.html.erb create app/views/recipes/new.html.erb create app/views/recipes/edit.html.erb create app/views/layouts/recipes.html.erb create public/stylesheets/scaffold.css dependency model exists app/models/ exists test/unit/ exists test/fixtures/ create app/models/recipe.rb create test/unit/recipe_test.rb create test/fixtures/recipes.yml exists db/migrate create db/migrate/002_create_recipes.rb create app/controllers/recipes_controller.rb create test/functional/recipes_controller_test.rb create app/helpers/recipes_helper.rb route map.resources :recipes C:\Tools\InstantRails-2.0\rails_apps\demo>
また、migrationファイルの書式も変わったようです。この例では下記のようになります。
class CreateRecipe < ActiveRecord::Migration def self.up create_table :recipes do |t| t.string :title, :default => '' t.string :description t.date :written_on t.text :instructions end end def self.down drop_table :recipes end end