Skip to content
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

sneaky_update attempts to update primary column #10

Open
sys-64738 opened this issue Jul 30, 2015 · 3 comments
Open

sneaky_update attempts to update primary column #10

sys-64738 opened this issue Jul 30, 2015 · 3 comments

Comments

@sys-64738
Copy link

I'm getting an error from my SQL Server database ("Cannot update identity column 'id'") when running "sneaky_save!" for updating an existing record because the SQL UPDATE statement also sets the "id" column (though it was actually not changed).

I see that "sneaky_create" has some code for handling primary key columns, but sneaky_update hasn't.

Shouldn't it actually just update only the columns from "changed_attributes", rather then all attributes? And then also reset changed_attributes to an empty hash afterwards?

@einzige
Copy link
Owner

einzige commented Sep 3, 2015

thanks @sys-64738 , i will take a look today

@einzige
Copy link
Owner

einzige commented Sep 8, 2015

@sys-64738 can you please provide the version of ActiveRecord you use, your gemfile, I am trying to reproduce.

@sys-64738
Copy link
Author

Thank you for looking into it. I have activerecord (3.2.22) and activerecord-sqlserver-adapter (3.2.13).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants