1
<%= 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.

user852974
  • 2,242
  • 10
  • 41
  • 65
  • 1
    Why don't you just view the source in your browser? That'll give you the html generated by the helper. – Ant Aug 12 '11 at 09:25

1 Answers1

2

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">
Anatoly
  • 15,298
  • 5
  • 53
  • 77