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.
<%= f.file_field :photo %>
我如何用html写这个?我知道这是一个输入类型 =“文件”,但我怎样才能放入:照片?我需要通过在 Rails 中用 html 编写字段来自定义字段。
f是对象名称,照片是属性名称,所以你有
id="object_photo" name="object[photo]" <input type="file" size="20" name="object[photo]" id="object_photo">