How specify size of string column in a migration

I am new to RoR. How do you specify the size of a string column in a
migration? The examples I’ve see are all of the form:

t.column :name, string

which produces a VARCHAR(255). I want a VARCHAR(40).

Thanks.

I am new to RoR. How do you specify the size of a string column in a
migration? The examples I’ve see are all of the form:

t.column :name, string

t.column :name, :string, :length => 40

1 Like

On Sep 27, 2007, at 6:58 PM, Philip H. wrote:

I am new to RoR. How do you specify the size of a string column in a
migration? The examples I’ve see are all of the form:

t.column :name, string

t.column :name, :string, :length => 40

And find out this and much more at:

http://api.rubyonrails.org/classes/ActiveRecord/ConnectionAdapters/
TableDefinition.html

-Rob

Rob B. http://agileconsultingllc.com
[email protected]

Try with

t.column :name, :string, limit: 40

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs