diff options
author | Robin Dupret <robin.dupret@gmail.com> | 2015-01-02 20:22:39 +0100 |
---|---|---|
committer | Robin Dupret <robin.dupret@gmail.com> | 2015-01-02 20:26:39 +0100 |
commit | 843fc997865566ff939f2d96871a8fce7f241ea5 (patch) | |
tree | 659706f3c47d06df0e9d0f94d5c05a7e70acab86 /actionview/lib | |
parent | c2d2a7d4cc0510448b68a3a4152b539c58c145de (diff) | |
download | rails-843fc997865566ff939f2d96871a8fce7f241ea5.tar.gz rails-843fc997865566ff939f2d96871a8fce7f241ea5.tar.bz2 rails-843fc997865566ff939f2d96871a8fce7f241ea5.zip |
Follow up to #17973 [ci skip]
Diffstat (limited to 'actionview/lib')
-rw-r--r-- | actionview/lib/action_view/helpers/form_helper.rb | 19 |
1 files changed, 10 insertions, 9 deletions
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 - # <tt>include_hidden: false</tt> option. + # In case you don't want the helper to generate this hidden field you can + # specify the <tt>include_hidden: false</tt> option. def file_field(object_name, method, options = {}) Tags::FileField.new(object_name, method, self, options).render end |