Created
November 21, 2013 16:31
-
-
Save joshwlewis/7585033 to your computer and use it in GitHub Desktop.
When using paper_trail and devise, new user versions are saved on each request.
The following prevents saving new user versions when devise trackable columns (sign_in_count, current_sign_in_at, last_sign_in_at, current_sign_in_ip, last_sign_in_ip) are updated.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class User < ActiveRecord::Base | |
devise :trackable | |
has_paper_trail | |
def update_tracked_fields!(request) | |
without_versioning { super(request) } | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Tested on Rails 4.0.1, Devise 3.0.3, PaperTrail 3.0.0.beta1.