关于Rails上的ruby:Simple_form输入太长

Simple_form inputs are too long

与Ruby on Rails一样,我使用simple_form gem以更优雅,更简单的方式处理表单。但是我有这个问题,字符串输入不能正确生成。我的意思是它们可以按预期工作,但是它们却非常长,就像完全不在我的屏幕上一样。这不是正常的行为吗?我应该为此应用任何特殊的CSS吗?也许还有其他解决方案?

我所拥有的这种形式是这样的:

1
2
3
4
5
6
7
= simple_form_for @book, url: books_path, method: :post do |f|
    = f.input :title, label: false, placeholder:"title"
    = f.input :author, label: false, placeholder:"author"
    = f.input :isbn, label: false, placeholder:"ISBN"
    = f.input :publishing_date, label: false, placeholder:"Publishing date"
    = f.input :amount, label: false, placeholder:"Amount"
    = f.submit class:"btn btn-success"

除此之外,我只是将'gem" simple_form"'放到Gemfile中,就是这样。


我通过键入simple_form width找到了一个很好的答案:

{:maxlength => 2,:style => \\'宽度:20px \\'}%>

来自此答案:

设置表单输入元素的宽度的Rails Simpleform