From b27a0986b701570fc877e4c46be347bf1281571d Mon Sep 17 00:00:00 2001 From: Rob Harrington Date: Thu, 6 Nov 2014 16:28:24 +1100 Subject: [PATCH] Ensure collection is locked down before we start asssigning attributes to model set --- app/models/model_set.rb | 3 +++ 1 file changed, 3 insertions(+) diff --git a/app/models/model_set.rb b/app/models/model_set.rb index d4760884b5..24e84008a0 100644 --- a/app/models/model_set.rb +++ b/app/models/model_set.rb @@ -8,6 +8,9 @@ class ModelSet def initialize(klass, collection, reject_if=nil, attributes={}) @klass, @collection, @reject_if = klass, collection, reject_if + # Set here first, to ensure that we apply collection_attributes to the right collection + @collection = attributes[:collection] if attributes[:collection] + attributes.each do |name, value| send("#{name}=", value) end