diff options
author | Pascal Ehlert <dadark@pascal-ehlerts-macbook-pro.local> | 2009-02-02 22:49:28 +0100 |
---|---|---|
committer | Michael Koziarski <michael@koziarski.com> | 2009-02-06 13:26:58 +1300 |
commit | d15d53cf810014b90827015ecd0e601176492fb7 (patch) | |
tree | 17360de26c0d809055db59953ee38199bbc348df /actionpack/lib/action_view/helpers/form_helper.rb | |
parent | c96382a71a77505ea2f51e43bc81fdb3ac95d117 (diff) | |
download | rails-d15d53cf810014b90827015ecd0e601176492fb7.tar.gz rails-d15d53cf810014b90827015ecd0e601176492fb7.tar.bz2 rails-d15d53cf810014b90827015ecd0e601176492fb7.zip |
Allowing an object to be passed explicitly to a fields_for with nested_attributes on one-to-one associations
Signed-off-by: Michael Koziarski <michael@koziarski.com>
[#1849 state:committed]
Diffstat (limited to 'actionpack/lib/action_view/helpers/form_helper.rb')
-rw-r--r-- | actionpack/lib/action_view/helpers/form_helper.rb | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/actionpack/lib/action_view/helpers/form_helper.rb b/actionpack/lib/action_view/helpers/form_helper.rb index 2ac2427884..0651f75cfb 100644 --- a/actionpack/lib/action_view/helpers/form_helper.rb +++ b/actionpack/lib/action_view/helpers/form_helper.rb @@ -971,7 +971,8 @@ module ActionView @template.fields_for(child_name, child, *args, &block) end.join else - @template.fields_for(name, association, *args, &block) + object = args.first.respond_to?(:new_record?) ? args.first : association + @template.fields_for(name, object, *args, &block) end end |