Skip to content
This repository has been archived by the owner on Jun 6, 2018. It is now read-only.

Commit

Permalink
support grace period where migrations have not yet run
Browse files Browse the repository at this point in the history
  • Loading branch information
cainlevy committed Mar 16, 2017
1 parent a26c0b6 commit 3244f2b
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions app/models/account.rb
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,19 @@ def sessions
@sessions ||= RefreshToken.sessions(id)
end

# TODO: remove in next release
def self.migrated?
column_names.include?('require_new_password')
end

def require_new_password?
read_attribute(:require_new_password) if self.class.migrated?
end

def require_new_password=(val)
write_attribute(:require_new_password, val) if self.class.migrated?
end

private def set_password_changed_at
self.password_changed_at = Time.now if password_changed?
end
Expand Down

0 comments on commit 3244f2b

Please sign in to comment.