New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

_readOnlyAttributes are incorrect when using underscored column names #1523

cjroth opened this Issue Mar 19, 2014 · 2 comments


3 participants

cjroth commented Mar 19, 2014

Using 1.7.0. Not sure if this applies to 2.0.0.

I have a model User with an underscored option set to true:

  var User = sequelize.define('User', {
    'name': { type: DataTypes.STRING },
  }, {
    tableName: 'users',
    paranoid: true,
    underscored: true,
  • user._readOnlyAttributes gives me camelcased attributes instead of underscored attributes
  • created_at, updated_at, and deleted_at are therefore not write protected when using user#set
var user ={ name: 'Chris' });
console.log('_readOnlyAttributes', user._readOnlyAttributes); // this is ['createdAt', 'updatedAt', 'deletedAt' ]
user.set('deleted_at', new Date());
console.log('deleted_at', user.values.deleted_at); // this is not null!

This comment has been minimized.


mickhansen commented Mar 19, 2014

Mind testing against master and seeing if it's still an issue? @janmeier did some refactoring of timestamps.

@mickhansen mickhansen added the Bug label Mar 19, 2014


This comment has been minimized.


janmeier commented Mar 23, 2014

It's still an issue, fixing in a bit :)

@janmeier janmeier closed this in 9906932 Mar 23, 2014

fixe pushed a commit to seegno-forks/sequelize that referenced this issue Mar 27, 2014

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment