models: fix Ruby 2.7 arguments passing
Arguments to an ActiveRecord scope will always been passed as a Dictionnary. Thus `Dossier.with_notifiable_procedure(notify_on_closed: true)` will trigger a Ruby 2.7 warning: > /ruby/2.7.0/gems/activerecord-6.0.3.4/lib/active_record/relation.rb:412: warning: Using the last argument as keyword parameters is deprecated; maybe ** should be added to the call Fix the issue by always expecting a Dictionary (rather than keyword arguments).
This commit is contained in:
parent
0d94eacf32
commit
4ad9adc510
1 changed files with 2 additions and 2 deletions
|
@ -227,8 +227,8 @@ class Dossier < ApplicationRecord
|
||||||
user: [])
|
user: [])
|
||||||
}
|
}
|
||||||
|
|
||||||
scope :with_notifiable_procedure, -> (notify_on_closed: false) do
|
scope :with_notifiable_procedure, -> (opts = { notify_on_closed: false }) do
|
||||||
states = notify_on_closed ? [:publiee, :close, :depubliee] : [:publiee, :depubliee]
|
states = opts[:notify_on_closed] ? [:publiee, :close, :depubliee] : [:publiee, :depubliee]
|
||||||
joins(:procedure)
|
joins(:procedure)
|
||||||
.where(procedures: { aasm_state: states })
|
.where(procedures: { aasm_state: states })
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in a new issue