Hi, I made a patch today to my code to solve a use case and wonder whether or not it would be useful for ActiveRecord users in general.
My setup is class Form has_many :sections has_many :questions, through: :sections accepts_nested_attributes_for :sections class class Section belongs_to :form has_many :questions accepts_nested_attributes_for :questions class class Question belongs_to :section end My form lets the user edit sections and questions. Drag and drop is also allowed to change question order but also to change the section it belongs to. With Rails code as is, it fails with a NotFound error, which is expected because each section looks for its own questions whenever a question has an `id` attribute: https://github.com/rails/rails/blob/d9715fcde450cebec3aeff74d4d39db5542d6625/activerecord/lib/active_record/nested_attributes.rb#L453 I'd suggest something like: class Section belongs_to :form has_many :questions accepts_nested_attributes_for :questions, scope: ->{ form.questions } class to fetch existing records based on a custom scope. Is this a desired feature? Should I submit a pull request? Benjamin -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Core" group. To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-core+unsubscr...@googlegroups.com. To post to this group, send email to rubyonrails-core@googlegroups.com. Visit this group at http://groups.google.com/group/rubyonrails-core. For more options, visit https://groups.google.com/d/optout.