If I go to rails console
I can’t get a create_table statement onto one line
irb(main):019:0> ActiveRecord::Migration.create_table :wers { |t| t.string :name }
SyntaxError: (irb):19: syntax error, unexpected ‘{’, expecting end-of-input
Migration.create_table :wers { |t| t.string :name }
I can see this works
irb(main):032:0> 5.times do |r|
irb(main):033:1* puts “a”
irb(main):034:1> end
and this works
irb(main):031:0> 5.times { |r| puts “a”}
And I can see this works
irb(main):039:0> ActiveRecord::Migration.create_table :haae do |t|
irb(main):040:1* t.string :firstname
irb(main):041:1> end
– create_table(:haae)
(4.0ms) CREATE TABLE “haae” (“id” INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, “firstname” varchar)
→ 0.0057s
=>
irb(main):042:0>
But I still can’t get that create_table line onto one line
irb(main):019:0> ActiveRecord::Migration.create_table :wers { |t| t.string :name }
SyntaxError: (irb):19: syntax error, unexpected ‘{’, expecting end-of-input
Migration.create_table :wers { |t| t.string :name }
I was able to replace the do and end on the 5.times line… with {…} and put it on one line, but I can’t get the same to work for create_table
I’m ok with putting it on multiple lines but I like the flexibility of being able to put it on one line should I so wish
Thanks