質問

<%= f.file_field :photo %>

How do I write this in html? I know that it's an input type="file" but how can I put in the :photo? I need to customise the field by writing it in html in rails.

役に立ちましたか?

解決

f is the oject name, photo is the attribute name, so you have

id="object_photo"
name="object[photo]"

<input type="file" size="20" name="object[photo]" id="object_photo">
ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top