Skip to content

assign_nested_attributes_for_collection_association does not call build method on extension defined for has_many association #33389

@martinsp

Description

@martinsp

Steps to reproduce

  1. Create a model with has_many association with extension defined using :extend option.
  2. Enable accepts_nested_attributes_for for the has_many association
  3. Build new associated objects with <association>_attributes= method

Failing test case: association-extension-failing.rb

I have found a way to fix the issue, but I'm not sure if my approach is correct. The fix is in: association-extension-fixed.rb on lines 92/93

Expected behavior

A build on association extension set by :extend option should be called

Actual behavior

A build method on association extension is not called

System configuration

Rails version: 5.2.0

Ruby version: ruby 2.5.1p57 (2018-03-29 revision 63029) [x86_64-darwin17]

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions