diff options
author | Carlos Antonio da Silva <carlosantoniodasilva@gmail.com> | 2010-09-26 00:01:10 +0800 |
---|---|---|
committer | José Valim <jose.valim@gmail.com> | 2010-09-26 02:13:47 +0800 |
commit | 63458994896c6e1b57f5c8716c637d74f1bb1c9e (patch) | |
tree | 791b25a0ee2065cb43653cb2e071485745fbe17d /actionpack/lib/action_view/helpers | |
parent | db57e92784f83d62a067282a131d7b09b44c3032 (diff) | |
download | rails-63458994896c6e1b57f5c8716c637d74f1bb1c9e.tar.gz rails-63458994896c6e1b57f5c8716c637d74f1bb1c9e.tar.bz2 rails-63458994896c6e1b57f5c8716c637d74f1bb1c9e.zip |
Remove last tests with deprecated form_for and cleanup form_for helper
This cleans up the last bits of deprecation stuff from form_for helper.
However there is still a bug when using :as => foo[], with index. The
classes and ids are being generated using [], such as foo[]_edit. This
bug already existed but it was not detected before.
Diffstat (limited to 'actionpack/lib/action_view/helpers')
-rw-r--r-- | actionpack/lib/action_view/helpers/form_helper.rb | 6 |
1 files changed, 2 insertions, 4 deletions
diff --git a/actionpack/lib/action_view/helpers/form_helper.rb b/actionpack/lib/action_view/helpers/form_helper.rb index 85ba6feb31..2b1d57c2b0 100644 --- a/actionpack/lib/action_view/helpers/form_helper.rb +++ b/actionpack/lib/action_view/helpers/form_helper.rb @@ -293,18 +293,16 @@ module ActionView # # If you don't need to attach a form to a model instance, then check out # FormTagHelper#form_tag. - def form_for(record, record_object = nil, options = nil, &proc) + def form_for(record, options = nil, &proc) raise ArgumentError, "Missing block" unless block_given? - options, record_object = record_object, nil if record_object.is_a?(Hash) options ||= {} options[:html] ||= {} case record when String, Symbol - ActiveSupport::Deprecation.warn("Using form_for(:name, @resource) is deprecated. Please use form_for(@resource, :as => :name) instead.", caller) if record_object object_name = record - object = record_object + object = nil else object = record.is_a?(Array) ? record.last : record object_name = options[:as] || ActiveModel::Naming.param_key(object) |