Permalink
Browse files

Fix negative expires_in values

  • Loading branch information...
1 parent 1e3a19e commit 9a3af8a31fad7b5624fa7ebbb8c226035d352470 @yury yury committed Oct 19, 2011
Showing with 2 additions and 2 deletions.
  1. +2 −2 lib/expirable_token.rb
View
@@ -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!

0 comments on commit 9a3af8a

Please sign in to comment.