Need some more details. According to your question I think you have to set the column length through model.
Let's say we have a model called customer.rb
and we have a column name "first_name" and we have to set its maximum length to 30 characters.
If the length exceed 30 characters then a error message should be shown.
So we have to do like this-
validates :first_name, presence: { message: 'Please enter your First Name.'}
validates :first_name, :length => { :maximum => 30, :message => 'Please enter a First Name of 30 characters or less in length.' }
Hope this will help!! :)