-
Notifications
You must be signed in to change notification settings - Fork 899
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
Ignoring attributes is not working #414
Comments
Okay, I solved this myself. the answer is to do:
A bit confusing though, would be nice to add this to docs. |
Apologies for the delayed response. Seems like it may be a bug in ActiveRecord |
Nevermind, I think I can reproduce this locally. Seems like it may be a change in the way ActiveModel::Dirty reports the timestamps into the changes hash. Either way, we are definitely going to need to fix this for |
After some additional testing I can confirm that this is a change in the way that datestamps get inserted into the Here is evidence: # id :integer not null, primary key
# name :string(255)
class Model < ActiveRecord::Base
before_update { p changed }
after_update { p changed }
end
# ActiveRecord 3
> model.update_attribute(:name, 'foo')
(0.1ms) SAVEPOINT active_record_1
['name']
(0.3ms) UPDATE "models" SET "name" = 'foo', "updated_at" = '2014-10-02 06:39:10.113930' WHERE "models"."id" = 1
['name', 'updated_at']
(0.0ms) RELEASE SAVEPOINT active_record_1
=> true
# ActiveRecord 4
> model.update_attribute(:name, 'foo')
(0.1ms) SAVEPOINT active_record_1
['name', 'updated_at']
(0.3ms) UPDATE "models" SET "name" = 'foo', "updated_at" = '2014-10-02 06:39:10.113930' WHERE "models"."id" = 1
['name', 'updated_at']
(0.0ms) RELEASE SAVEPOINT active_record_1
=> true |
Thanks! Will be much more straightforward to ignore updated_at |
Just released version |
👍 |
Using paper_trail 3.0.3 and rails 4.1.5
In my model, I've tried all three of the following:
My test is as such:
Am I doing something funky or is this feature not working? Any troubleshooting ideas?
The text was updated successfully, but these errors were encountered: