Skip to content

Commit

Permalink
Don't remove record from params with ephemeral notifications (#448)
Browse files Browse the repository at this point in the history
  • Loading branch information
excid3 authored May 23, 2024
1 parent 923d390 commit 2a3dbb0
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
8 changes: 6 additions & 2 deletions app/models/concerns/noticed/deliverable.rb
Original file line number Diff line number Diff line change
Expand Up @@ -70,8 +70,12 @@ def param(*names)
end

def with(params)
record = params.delete(:record)
new(params: params, record: record)
if self < Ephemeral
new(params: params)
else
record = params.delete(:record)
new(params: params, record: record)
end
end

def deliver(recipients = nil, **options)
Expand Down
4 changes: 4 additions & 0 deletions test/ephemeral_notifier_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,8 @@ class EphemeralNotifierTest < ActiveSupport::TestCase
perform_enqueued_jobs
end
end

test "ephemeral has record shortcut" do
assert_equal :foo, EphemeralNotifier.with(record: :foo).record
end
end

0 comments on commit 2a3dbb0

Please sign in to comment.