Maximum length on a textarea in Ruby on Rails

前端 未结 4 1519
花落未央
花落未央 2020-12-20 12:23

I tried applying the :maxlenght => 40 on a textarea on my form. But it didn\'t work out. Can we have a length limit on a textarea?

The code for text are

4条回答
  •  [愿得一人]
    2020-12-20 13:14

    Not strictly what you're after of course, but, you can always put a:

    validates_length_of :data, max: 40
    

    on your model. Won't stop the textarea size of course :)

提交回复
热议问题