Forum: Ruby on Rails scaffold_resource doc / usage bug

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
515264ba6b2d0c63578042cbfd91ad47?d=identicon&s=25 dmack (Guest)
on 2007-01-15 19:41
(Received via mailing list)
Running the scaffold_resource generator outputs usage information as
follows:

  % ./script/generate scaffold_resource
  Usage: ./script/generate scaffold_resource ModelName [field:type,
field:type]
  <snip>

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
This topic is locked and can not be replied to.