Skip to content

Commit

Permalink
Fix test
Browse files Browse the repository at this point in the history
  • Loading branch information
npezza93 committed Oct 11, 2024
1 parent 91540ba commit 5ec8fca
Showing 1 changed file with 3 additions and 6 deletions.
9 changes: 3 additions & 6 deletions app/models/solid_cable/message.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,6 @@

module SolidCable
class Message < SolidCable::Record
has_one :channel_record, class_name: "::SolidCable::Channel",
foreign_key: :channel_hash, primary_key: :channel_hash

scope :trimmable, lambda {
where(created_at: ...::SolidCable.message_retention.ago)
}
Expand All @@ -15,10 +12,10 @@ class Message < SolidCable::Record

class << self
def broadcast(channel, payload)
insert({ created_at: Time.current, channel:, payload:,
channel_hash: channel_hash_for(channel) })
channel_hash = channel_hash_for(channel)
insert({ created_at: Time.current, channel:, payload:, channel_hash: })

channel_record&.subscribers.to_i
::SolidCable::Channel.find_by(channel_hash:)&.subscribers.to_i
end
end
end
Expand Down

0 comments on commit 5ec8fca

Please sign in to comment.