Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我正在使用简单形式的 gem 来呈现我的表单。我正在尝试将输入字段类型设置为“数字”。此代码不起作用:
f.input :amount, input_html: { type: 'number' }
设置它的正确方法是什么?
以下应该工作
一种更清洁的方法是:
f.input :amount, as: :numeric
希望能帮助到你 !
最简单的方法:
f.input :whatever, as: :numeric
尝试:
f.input :amount, as: :integer