uniqueness constraint is not correct scoping on hidden is not fully correct

simpler just to handle it in the DB
This commit is contained in:
Sam 2014-11-20 16:47:59 +11:00
parent 57ef9bb21b
commit 73041c0e14

View File

@ -3,7 +3,6 @@ class ApiKey < ActiveRecord::Base
belongs_to :created_by, class_name: User
validates_presence_of :key
validates_uniqueness_of :user_id
def regenerate!(updated_by)
self.key = SecureRandom.hex(32)