Paul Lynch
Paul Lynch

Reputation: 1337

Setting maxlength using database schema settings

Is there a good way to set maxlength on input tags using the corresponding limits from the database schema? I can always check the database lengths for fields, and then hard code the maxlength values, but I would prefer not to have those settings in two places.

Upvotes: 0

Views: 95

Answers (1)

sarvavijJana
sarvavijJana

Reputation: 1212

Refer to rails api docs TableDefinition#column :limit suits your needs

Upvotes: 1

Related Questions