# Migration crashes when using braces to delimit blocks

**URL:** <https://www.ruby-forum.com/t/migration-crashes-when-using-braces-to-delimit-blocks/65510>\
**Category:** Rails\
**Created:** [August 18, 2006, 8:45pm UTC](https://www.ruby-forum.com/t/migration-crashes-when-using-braces-to-delimit-blocks/65510 "2006-08-18T20:45:14Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Michael\_McGreevy](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/eb8c5e/32.png) [@Michael\_McGreevy](https://www.ruby-forum.com/u/Michael_McGreevy)\
**Post date:** [August 18, 2006, 8:45pm UTC](https://www.ruby-forum.com/t/migration-crashes-when-using-braces-to-delimit-blocks/65510/1 "2006-08-18T20:45:14Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![Michael\_McGreevy](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/eb8c5e/32.png) [@Michael\_McGreevy](https://www.ruby-forum.com/u/Michael_McGreevy)\
**Post date:** [August 18, 2006, 9:03pm UTC](https://www.ruby-forum.com/t/migration-crashes-when-using-braces-to-delimit-blocks/65510/2 "2006-08-18T21:03:16Z")

</div>

> 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?

Hmm, posted to soon, I’ve found the answer. It’s a precedence thing –  
if I  
wrap the parameter to create\_table in parentheses, everything is fine.
