Ensure collection is locked down before we start asssigning attributes to model set

This commit is contained in:
Rob Harrington
2014-11-06 16:28:24 +11:00
parent be042af751
commit b27a0986b7

View File

@@ -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