Skip to content

Commit

Permalink
Add deliver_later and param(s) methods with deprecations
Browse files Browse the repository at this point in the history
  • Loading branch information
excid3 committed Jan 25, 2024
1 parent e905ca6 commit 094b340
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions app/models/concerns/noticed/deliverable.rb
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,20 @@ def required_params(*names)
end
alias_method :required_param, :required_params

def params(*names)
Noticed.deprecator.warn <<-WARNING.squish
`params` is deprecated and has been renamed to `required_params`
WARNING
required_params(*names)
end

def param(*names)
Noticed.deprecator.warn <<-WARNING.squish
`param :name` is deprecated and has been renamed to `required_param :name`
WARNING
required_params(*names)
end

def with(params)
record = params.delete(:record)
new(params: params, record: record)
Expand All @@ -53,6 +67,11 @@ def with(params)
def deliver(recipients = nil, options = {})
new.deliver(recipients, options)
end

# For backwards compatibility
def deliver_later(recipients = nil, options = {})
deliver(recipients, options)
end
end

# CommentNotifier.deliver(User.all)
Expand Down

0 comments on commit 094b340

Please sign in to comment.