Implement Key.authenticate

This commit is contained in:
Thibault Jouan
2015-05-06 03:12:58 +00:00
parent 78f79c4c34
commit 0f1f7106b2
2 changed files with 22 additions and 0 deletions

View File

@@ -4,4 +4,10 @@ class Key < ActiveRecord::Base
has_secure_token :token
validates :name, presence: true
class << self
def authenticate token
find_by_token token
end
end
end