has_many_polymorphs icon indicating copy to clipboard operation
has_many_polymorphs copied to clipboard

HMP with accepts_nested_attributes_for breaks when assigning nested attributes

Open brettdh opened this issue 16 years ago • 0 comments

In ActiveRecord's accepts_nested_attributes_for, it uses a case statement on the reflection macro to determine the association type, and predictably, it doesn't include :has_many_polymorphs, which results in a call to a nonexistent method.

See my fork for a failing test case and possible fix for Rails 2.3.5 (test fails on master, succeeds on nested_attributes_fix branch): http://github.com/brettdh/has_many_polymorphs

I'm a Rails neophyte, so I'm not sure what would be The Right Way to fix this, since the fix requires a complete override of the relevant methods. How might I go about keeping such an override working over different Rails versions?

brettdh avatar Jan 02 '10 01:01 brettdh