Skip to content

Commit dcb1d1f

Browse files
Use to_sentence to show list of methods without using I18n
This code was introduced by rails#17221 to workaround issues with not having the `:en` locale set in the app to translate when calling `to_sentence`, when having `I18n.enforce_available_locales` enabled. We can still use the helper, with the defaults provided by the code, without using I18n and thus without relying on the app locale, by passing the `locale: false` option.
1 parent 5f3a817 commit dcb1d1f

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

actionpack/lib/action_dispatch/http/request.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -454,7 +454,7 @@ def commit_csrf_token
454454
private
455455
def check_method(name)
456456
if name
457-
HTTP_METHOD_LOOKUP[name] || raise(ActionController::UnknownHttpMethod, "#{name}, accepted HTTP methods are #{HTTP_METHODS[0...-1].join(', ')}, and #{HTTP_METHODS[-1]}")
457+
HTTP_METHOD_LOOKUP[name] || raise(ActionController::UnknownHttpMethod, "#{name}, accepted HTTP methods are #{HTTP_METHODS.to_sentence(locale: false)}")
458458
end
459459

460460
name

0 commit comments

Comments
 (0)