Files
fizzy/app/models/bubble/boostable.rb
T
2024-12-13 16:54:11 -06:00

19 lines
343 B
Ruby

module Bubble::Boostable
extend ActiveSupport::Concern
included do
scope :ordered_by_boosts, -> { order boosts_count: :desc }
end
def boost!(count = 1)
count = count.to_i
count = 1 if count < 1
transaction do
track_event :boosted, count: count
update! boosts_count: count
rescore
end
end
end