We were passing a hash when the method definition expected keyword arguments, and so we were getting warnings in Ruby 2.7: ``` db/dev_seeds/widgets.rb:11: warning: Using the last argument as keyword parameters is deprecated; maybe ** should be added to the call db/dev_seeds/widgets.rb:23: warning: Using the last argument as keyword parameters is deprecated; maybe ** should be added to the call db/dev_seeds/widgets.rb:35: warning: Using the last argument as keyword parameters is deprecated; maybe ** should be added to the call db/dev_seeds/widgets.rb:47: warning: Using the last argument as keyword parameters is deprecated; maybe ** should be added to the call db/dev_seeds/admin_notifications.rb:3: warning: Using the last argument as keyword parameters is deprecated; maybe ** should be added to the call db/dev_seeds/admin_notifications.rb:11: warning: Using the last argument as keyword parameters is deprecated; maybe ** should be added to the call db/dev_seeds/admin_notifications.rb:19: warning: Using the last argument as keyword parameters is deprecated; maybe ** should be added to the call db/dev_seeds/admin_notifications.rb:27: warning: Using the last argument as keyword parameters is deprecated; maybe ** should be added to the call ``` Converting the hash to keyword arguments solves the issue.
37 lines
1.2 KiB
Ruby
37 lines
1.2 KiB
Ruby
section "Creating Admin Notifications & Templates" do
|
|
AdminNotification.create!(
|
|
random_locales_attributes(
|
|
**%i[title body].index_with do |attribute|
|
|
-> { I18n.t("seeds.admin_notifications.proposal.#{attribute}") }
|
|
end
|
|
).merge(
|
|
link: Rails.application.routes.url_helpers.proposals_url(Tenant.current_url_options),
|
|
segment_recipient: "administrators"
|
|
)
|
|
).deliver
|
|
|
|
AdminNotification.create!(
|
|
random_locales_attributes(
|
|
**%i[title body].index_with do |attribute|
|
|
-> { I18n.t("seeds.admin_notifications.help.#{attribute}") }
|
|
end
|
|
).merge(link: "https://crwd.in/consul", segment_recipient: "administrators")
|
|
).deliver
|
|
|
|
AdminNotification.create!(
|
|
random_locales_attributes(
|
|
**%i[title body].index_with do |attribute|
|
|
-> { I18n.t("seeds.admin_notifications.map.#{attribute}") }
|
|
end
|
|
).merge(segment_recipient: "administrators")
|
|
).deliver
|
|
|
|
AdminNotification.create!(
|
|
random_locales_attributes(
|
|
**%i[title body].index_with do |attribute|
|
|
-> { I18n.t("seeds.admin_notifications.budget.#{attribute}") }
|
|
end
|
|
).merge(segment_recipient: "administrators", sent_at: nil)
|
|
)
|
|
end
|