21

In Rails Migrations, what does the number specified for the :limit parameter on an integer represent? Is it the number of bytes or the number of digits?

i.e. If I were to specify the following:

t.integer :coefficient, :limit => 2

Does that mean the SQL database will reserve two bytes for each integer, or that each integer can not have more than two digits? I'm assuming it means bytes, but I'm not positive.

Thanks!

1
  • By the way, that should be t.integer :coefficient, :limit => 2 so that :coefficient is a symbol.
    – Peeja
    Dec 9, 2008 at 21:47

1 Answer 1

33

According to the documentation, it's the number of characters for :string and :text columns and the number of bytes for :binary and :integer columns.

1

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.