From 843fc997865566ff939f2d96871a8fce7f241ea5 Mon Sep 17 00:00:00 2001 From: Robin Dupret Date: Fri, 2 Jan 2015 20:22:39 +0100 Subject: Follow up to #17973 [ci skip] --- actionview/lib/action_view/helpers/form_helper.rb | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) (limited to 'actionview/lib') diff --git a/actionview/lib/action_view/helpers/form_helper.rb b/actionview/lib/action_view/helpers/form_helper.rb index e3a8f998a8..8d78ba13d5 100644 --- a/actionview/lib/action_view/helpers/form_helper.rb +++ b/actionview/lib/action_view/helpers/form_helper.rb @@ -857,20 +857,21 @@ module ActionView # # ==== Gotcha # - # The HTML specification says when nothing is select on a file field web browsers do not send any value to server. - # Unfortunately this introduces a gotcha: - # if an +User+ model has a +avatar+ field, and in the form none file is selected no +avatar+ parameter is sent. So, - # any mass-assignment idiom like + # The HTML specification says that when a file field is empty, web browsers + # do not send any value to the server. Unfortunately this introduces a + # gotcha: if a +User+ model has an +avatar+ field, and no file is selected, + # then the +avatar+ parameter is empty. Thus, any mass-assignment idiom like # # @user.update(params[:user]) # - # wouldn't update avatar. + # wouldn't update the +avatar+ field. # - # To prevent this the helper generates an auxiliary hidden field before - # every file field. The hidden field has the same name as file field and blank value. + # To prevent this, the helper generates an auxiliary hidden field before + # every file field. The hidden field has the same name as the file one and + # a blank value. # - # In case if you don't want the helper to generate this hidden field you can specify - # include_hidden: false option. + # In case you don't want the helper to generate this hidden field you can + # specify the include_hidden: false option. def file_field(object_name, method, options = {}) Tags::FileField.new(object_name, method, self, options).render end -- cgit v1.2.3