sdepold/sequelize — pull request #278 by robraux (2012-10-01 13:58:58+00:00)
Title: Association injections overwrite existing defined validations

Attribute Injection uses underscore's extend, which overwrites any validation (or other attributes) previously defined in the model.

The patch uses underscore's defaults command, which only overwrites the rawAttributes if the column is not already defined.

The reason for this change is validation. If we want to ensure that the field is required, we define the validation at time the rest of the structure is defined. After this fact, associations are added. Without this patch, the attribute will overwrite the property with just the definition of the name, stripping out all other attributes in the definition.
--
Re-requested from a close #258 since I did not use a topic branch to request pull.