9d4dd3b00e
Removes the creating status completely as well as the abandoned cards system. It will always resume drafts if they exist, for a given collection and user. https://app.box-car.com/5986089/cards/2489
19 lines
418 B
Ruby
19 lines
418 B
Ruby
module Card::Statuses
|
|
extend ActiveSupport::Concern
|
|
|
|
included do
|
|
enum :status, %w[ drafted published ].index_by(&:itself)
|
|
|
|
after_create -> { track_event :published }, if: :published?
|
|
|
|
scope :published_or_drafted_by, ->(user) { where(status: :published).or(where(status: :drafted, creator: user)) }
|
|
end
|
|
|
|
def publish
|
|
transaction do
|
|
published!
|
|
track_event :published
|
|
end
|
|
end
|
|
end
|