How SimpleForm maxlength extension works
问题 I want to set the maxlength html attribute of the inputs on my forms created with the help of the SimpleForm gem. I know I can do this by passing in the maxlength attribute manually when creating the form, e.g.: <%= f.input :username, input_html: { maxlength: 20 } %> But that isn’t want I want because according the comments in the SimpleForm config file you should enable the maxlength extension which adds automatically this html attribute to the input tag for string attributes when a max