diff options
author | Santiago Pastorino <santiago@wyeworks.com> | 2010-09-22 12:35:20 -0300 |
---|---|---|
committer | Santiago Pastorino <santiago@wyeworks.com> | 2010-09-22 12:39:54 -0300 |
commit | b73d5e81ec010cfe189b3ecb4ed1628b4cf3a14e (patch) | |
tree | 436f9079b91fe3fefb7b2a5436a3f06715f5d923 | |
parent | aa85a7a7e70ece22728aa3463fc3427c624d8296 (diff) | |
download | rails-b73d5e81ec010cfe189b3ecb4ed1628b4cf3a14e.tar.gz rails-b73d5e81ec010cfe189b3ecb4ed1628b4cf3a14e.tar.bz2 rails-b73d5e81ec010cfe189b3ecb4ed1628b4cf3a14e.zip |
form_for with file_field docs fixed
-rw-r--r-- | railties/guides/source/form_helpers.textile | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/railties/guides/source/form_helpers.textile b/railties/guides/source/form_helpers.textile index 146b75da3f..eb2bbc4ee9 100644 --- a/railties/guides/source/form_helpers.textile +++ b/railties/guides/source/form_helpers.textile @@ -549,7 +549,7 @@ will produce the same output if the current year is 2009 and the value chosen by h3. Uploading Files -A common task is uploading some sort of file, whether it's a picture of a person or a CSV file containing data to process. The most important thing to remember with file uploads is that the form's encoding *MUST* be set to "multipart/form-data". If you forget to do this the file will not be uploaded. This can be done by passing +:multi_part => true+ as an HTML option. This means that in the case of +form_tag+ it must be passed in the second options hash and in the case of +form_for+ inside the +:html+ hash. +A common task is uploading some sort of file, whether it's a picture of a person or a CSV file containing data to process. The most important thing to remember with file uploads is that the form's encoding *MUST* be set to "multipart/form-data". If you're using +form_for+ just using +file_field+ inside of it does the trick, but if you're using +form_tag+ +:multi_part => true+ must passed as an HTML option, in the second options hash. If you forget to do this the file will not be uploaded. The following two forms both upload a file. @@ -558,7 +558,7 @@ The following two forms both upload a file. <%= file_field_tag 'picture' %> <% end %> -<%= form_for @person, :html => {:multipart => true} do |f| %> +<%= form_for @person do |f| %> <%= f.file_field :picture %> <% end %> </erb> |