Last active
December 15, 2015 06:39
-
-
Save tonatiuh/5217695 to your computer and use it in GitHub Desktop.
To set the 'update_at' (the last time the user signed in) field value to the 'signed_up_at' for the users who have that field as nil.
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
| User.where(signed_up_at: nil).each do |user| | |
| if user.oauth_token.present? then | |
| user.signed_up_at = user.updated_at | |
| user.save | |
| end | |
| end |
User.where(signed_up_at: nil).where('oauth_token IS NOT NULL').update_all('signed_up_at = updated_at')
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
user.oauth_token.present?