Files
fizzy/app/models/bubble/draftable.rb
T
2025-02-11 14:34:39 +00:00

17 lines
365 B
Ruby

module Bubble::Draftable
extend ActiveSupport::Concern
included do
enum :status, %w[ creating drafted published ].index_by(&:itself)
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