Set the size of a field in migration

Asked

Viewed 207 times

0

How do I set the size of a string-like field in a Migration? Ex:

class CreateRooms < ActiveRecord::Migration
def change
create_table :rooms do |t|
  t.string :title
  t.string :location
  t.text :description

  t.timestamps
end
end
end

How can I say that the title field is varchar(50)

1 answer

0


Browser other questions tagged

You are not signed in. Login or sign up in order to post.