Sha256: 98bc10f475ab218ed004c4c4d70f79b5d668b101d2adf9ffeb2d893f6c4cf237

Contents?: true

Size: 648 Bytes

Versions: 11

Compression:

Stored size: 648 Bytes

Contents

module DiscoApp::Concerns::Plan
  extend ActiveSupport::Concern

  included do

    has_many :subscriptions
    has_many :shops, through: :subscriptions
    has_many :plan_codes, dependent: :destroy

    accepts_nested_attributes_for :plan_codes, allow_destroy: true

    enum status: {
      available: 0,
      unavailable: 1
    }
    enum plan_type: {
      recurring: 0,
      one_time: 1
    }
    enum interval: {
      month: 0,
      year: 1
    }

    scope :available, -> { where status: statuses[:available] }

    validates_presence_of :name

  end

  def has_trial?
    trial_period_days.present? and trial_period_days > 0
  end

end

Version data entries

11 entries across 11 versions & 1 rubygems

Version Path
disco_app-0.16.1.pre.sidekiq.pre.6.pre.release app/models/disco_app/concerns/plan.rb
disco_app-0.13.8 app/models/disco_app/concerns/plan.rb
disco_app-0.14.1 app/models/disco_app/concerns/plan.rb
disco_app-0.14.2 app/models/disco_app/concerns/plan.rb
disco_app-0.15.0 app/models/disco_app/concerns/plan.rb
disco_app-0.16.0 app/models/disco_app/concerns/plan.rb
disco_app-0.14.4 app/models/disco_app/concerns/plan.rb
disco_app-0.14.3 app/models/disco_app/concerns/plan.rb
disco_app-0.16.1 app/models/disco_app/concerns/plan.rb
disco_app-0.15.2 app/models/disco_app/concerns/plan.rb
disco_app-0.14.0 app/models/disco_app/concerns/plan.rb