Passing in a Hash instance as kwargs parameters requires the "double splat" prefix
This commit is contained in:
parent
58df38818a
commit
4071115ddd
@ -166,7 +166,7 @@ module CacheHelper
|
||||
def cache(name = {}, options = {}, &block)
|
||||
if controller.respond_to?(:perform_caching) && controller.perform_caching
|
||||
name_options = options.slice(:skip_digest, :virtual_path)
|
||||
safe_concat(fragment_for(cache_fragment_name(name, name_options), options, &block))
|
||||
safe_concat(fragment_for(cache_fragment_name(name, **name_options), options, &block))
|
||||
else
|
||||
yield
|
||||
end
|
||||
|
@ -755,10 +755,10 @@ def form_with(model: nil, scope: nil, url: nil, format: nil, **options, &block)
|
||||
output = capture(builder, &block)
|
||||
options[:multipart] ||= builder.multipart?
|
||||
|
||||
html_options = html_options_for_form_with(url, model, options)
|
||||
html_options = html_options_for_form_with(url, model, **options)
|
||||
form_tag_with_body(html_options, output)
|
||||
else
|
||||
html_options = html_options_for_form_with(url, model, options)
|
||||
html_options = html_options_for_form_with(url, model, **options)
|
||||
form_tag_html(html_options)
|
||||
end
|
||||
end
|
||||
|
@ -107,8 +107,8 @@ def respond_to_missing?(*args)
|
||||
true
|
||||
end
|
||||
|
||||
def method_missing(called, *args, &block)
|
||||
tag_string(called, *args, &block)
|
||||
def method_missing(called, *args, **options, &block)
|
||||
tag_string(called, *args, **options, &block)
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -82,14 +82,14 @@ def translate(key, options = {})
|
||||
html_safe_options[name] = ERB::Util.html_escape(value.to_s)
|
||||
end
|
||||
end
|
||||
translation = I18n.translate(scope_key_by_partial(key), html_safe_options.merge(raise: i18n_raise))
|
||||
translation = I18n.translate(scope_key_by_partial(key), **html_safe_options.merge(raise: i18n_raise))
|
||||
if translation.respond_to?(:map)
|
||||
translation.map { |element| element.respond_to?(:html_safe) ? element.html_safe : element }
|
||||
else
|
||||
translation.respond_to?(:html_safe) ? translation.html_safe : translation
|
||||
end
|
||||
else
|
||||
I18n.translate(scope_key_by_partial(key), options.merge(raise: i18n_raise))
|
||||
I18n.translate(scope_key_by_partial(key), **options.merge(raise: i18n_raise))
|
||||
end
|
||||
rescue I18n::MissingTranslationData => e
|
||||
if remaining_defaults.present?
|
||||
|
@ -62,7 +62,7 @@ def form_text(action = "http://www.example.com", local: false, **options)
|
||||
end
|
||||
|
||||
def whole_form(action = "http://www.example.com", options = {})
|
||||
out = form_text(action, options) + hidden_fields(options)
|
||||
out = form_text(action, **options) + hidden_fields(options)
|
||||
|
||||
if block_given?
|
||||
out << yield << "</form>"
|
||||
@ -168,7 +168,7 @@ def test_form_with_with_block_in_erb_and_local_true
|
||||
end
|
||||
|
||||
class FormWithActsLikeFormForTest < FormWithTest
|
||||
def form_with(*)
|
||||
def form_with(*, **)
|
||||
@output_buffer = super
|
||||
end
|
||||
|
||||
|
@ -368,7 +368,7 @@ def test_word_wrap_with_leading_spaces
|
||||
def test_word_wrap_does_not_modify_the_options_hash
|
||||
options = { line_width: 15 }
|
||||
passed_options = options.dup
|
||||
word_wrap("some text", passed_options)
|
||||
word_wrap("some text", **passed_options)
|
||||
assert_equal options, passed_options
|
||||
end
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user