Sha256: 142894637ee7d903f1d8b9c9b44082023342e04084a479841059f766eb6aa3e0
Contents?: true
Size: 625 Bytes
Versions: 2
Compression:
Stored size: 625 Bytes
Contents
module Susply class Subscription < ActiveRecord::Base belongs_to :owner, class_name: Susply.subscription_owner_class belongs_to :plan, class_name: 'Susply::Plan' validates_presence_of :owner_id, :plan_id, :start, :current_period_start, :current_period_end validates :quantity, numericality: { only_integer: true, greater_than: 0 } def name plan.name end def price plan.price end def active? deactivated_at.nil? end def expired? current_period_end < Time.zone.now end def allowed_to_renew? active? && expired? end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
susply-1.0.0 | app/models/susply/subscription.rb |
susply-0.0.2 | app/models/susply/subscription.rb |