Running the scaffold_resource generator outputs usage information as
follows:
% ./script/generate scaffold_resource
Usage: ./script/generate scaffold_resource ModelName [field:type,
field:type]
Which seems to indicate that one would type the command with the
optional fields separated by COMMAS. For example:
% ./script/generate scaffold_resource Jump num:integer,
location_id:integer, description:text
This yields no errors on invocation, but it does yield a broken
migration:
class CreateJumps < ActiveRecord::Migration
def self.up
create_table :jumps do |t|
t.column :num, :integer,
t.column :location_id, :integer,
t.column :description, :text
end
end
The commas are added to the create_table loop and break the migration
as ‘rake db:migrate’ demonstrates:
% rake db:migrate
(in /usr/home/foo/src/sample)
rake aborted!
./db/migrate//001_create_jumps.rb:5: parse error, unexpected tSYMBEG,
expecting kEND
t.column :location_id, :integer,
^
(See full trace by running task with --trace)
The examples on the bottom of the usage page for scaffold_resource are
correct but the [field:type, field:type] text for the command line
usage seems to indicate that one should separate the fields by commas
and that does not work.
I’m using Rails 1.2RC1 (1.1.6.5848) with postgres-pr.
Dan