Specifying String Field Lengths in Ruby on Rails

I cannot generate string fields with the specified length in the migration. They are always created with a length of 255 characters.

Somebody knows?

+4
source share
1 answer

I think you are looking for the option :limit :

 class CreateUser < ActiveRecord::Migration def change create_table :users do |t| t.string :name, :limit => 10 end end end 

Link

+9
source

Source: https://habr.com/ru/post/1386272/


All Articles