Hi,
I have been using a bit of ruby here and there for scripting jobs for
a year
or so, and more recently have started dabbling in rails. I was
wondering if
anyone can help me with a strange behaviour I am getting when trying to
run a
migration. If I delimit a block for the create_table method with
braces, the
migration crashes, whereas the exact same code with the braces replaced
by
do/end runs fine. Does anybody have any idea why this would be?
Thanks,
Michael.
========== Migration Code: ==========
class SimplifiedVersion < ActiveRecord::Migration
def self.up
create_table :functional_rights { |t| # A table storing the actions on
a
given controller that a given right allows a user to perform.
t.column :name, :string, :null => false
t.column :controller, :string, :null => false
t.column :action, :string, :null => false
}
end
def self.down
drop_table :functional_rights
end
end
========== Output from rake: ==========
rake aborted!
./db/migrate//002_simplified_version.rb:4: syntax error, unexpected ‘{’,
expecting kEND
create_table :functional_rights { |t| # A table storing the
actions
on a given controller that a given right allows a user to perform.
^
./db/migrate//002_simplified_version.rb:5: syntax error, unexpected
tSYMBEG,
expecting kEND
t.column :name, :string, :null => false
^
./db/migrate//002_simplified_version.rb:8: syntax error, unexpected ‘}’,
expecting kEND
./db/migrate//002_simplified_version.rb:15: syntax error, unexpected
$end,
expecting kEND