0
0
Fork 0

Fix subscription expiration condition (#2715)

* Fix subscription expiration condition

* dry and add spec
This commit is contained in:
Yamagishi Kazutoshi 2017-05-03 01:21:22 +09:00 committed by Eugen Rochko
parent b9b78549f3
commit 6f75c8451d
3 changed files with 20 additions and 3 deletions

View file

@ -33,6 +33,10 @@ class Subscription < ApplicationRecord
(expires_at - Time.now.utc).to_i
end
def expired?
Time.now.utc > expires_at
end
before_validation :set_min_expiration
private