Sha256: 83c54bc569b4d6bf9bdcbe5a67f8278815c32c1f9fe0d35410a9220c27851b85

Contents?: true

Size: 540 Bytes

Versions: 2

Compression:

Stored size: 540 Bytes

Contents

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

  included do

    has_many :subscriptions
    has_many :shops, through: :subscriptions
    has_many :plan_codes

    accepts_nested_attributes_for :plan_codes

    enum status: [:available, :unavailable]
    enum plan_type: [:recurring, :one_time]
    enum interval: [:month, :year]

    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

2 entries across 2 versions & 1 rubygems

Version Path
disco_app-0.8.8 app/models/disco_app/concerns/plan.rb
disco_app-0.8.9 app/models/disco_app/concerns/plan.rb