Merge pull request #8649 from Matt-Yorkley/deprecation-fixes

Deprecation fixes
This commit is contained in:
Maikel
2022-01-13 15:59:47 +11:00
committed by GitHub
2 changed files with 13 additions and 1 deletions

View File

@@ -0,0 +1,12 @@
module CanCanUnauthorizedMessage
# Fix deprecated syntax calling I18n#translate (using keyword args) without using **
def unauthorized_message(action, subject)
keys = unauthorized_message_keys(action, subject)
variables = {:action => action.to_s}
variables[:subject] = (subject.class == Class ? subject : subject.class).to_s.underscore.humanize.downcase
message = I18n.translate(nil, **variables.merge(:scope => :unauthorized, :default => keys + [""]))
message.blank? ? nil : message
end
end
CanCan::Ability.prepend(CanCanUnauthorizedMessage)

View File

@@ -37,7 +37,7 @@ module OpenFoodNetwork
def search
permissions = ::Permissions::Order.new(user)
permissions.editable_orders.complete.not_state(:canceled).search(params[:q])
permissions.editable_orders.complete.not_state(:canceled).ransack(params[:q])
end
def orders