Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Fix negative expires_in values

  • Loading branch information...
commit 9a3af8a31fad7b5624fa7ebbb8c226035d352470 1 parent 1e3a19e
@yury yury authored
Showing with 2 additions and 2 deletions.
  1. +2 −2 lib/expirable_token.rb
View
4 lib/expirable_token.rb
@@ -8,7 +8,7 @@ def self.included(klass)
belongs_to :client
field :token
- field :expires_at, type: DateTime
+ field :expires_at, type: Time
before_validation :init_token, :on => :create, :unless => :token?
before_validation :init_expires_at, :on => :create, :unless => :expires_at?
@@ -22,7 +22,7 @@ def self.included(klass)
end
def expires_in
- expires_at.to_i - Time.now.utc.to_i
+ expires_at.utc.to_i - Time.now.utc.to_i
end
def expired!
Please sign in to comment.
Something went wrong with that request. Please try again.