sdepold/sequelize — pull request #258 by robraux (2012-08-23 21:56:15+00:00)
Title: Associations overwrite previously defined columns

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.