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)
|
def cache(name = {}, options = {}, &block)
|
||||||
if controller.respond_to?(:perform_caching) && controller.perform_caching
|
if controller.respond_to?(:perform_caching) && controller.perform_caching
|
||||||
name_options = options.slice(:skip_digest, :virtual_path)
|
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
|
else
|
||||||
yield
|
yield
|
||||||
end
|
end
|
||||||
|
@ -755,10 +755,10 @@ def form_with(model: nil, scope: nil, url: nil, format: nil, **options, &block)
|
|||||||
output = capture(builder, &block)
|
output = capture(builder, &block)
|
||||||
options[:multipart] ||= builder.multipart?
|
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)
|
form_tag_with_body(html_options, output)
|
||||||
else
|
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)
|
form_tag_html(html_options)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -107,8 +107,8 @@ def respond_to_missing?(*args)
|
|||||||
true
|
true
|
||||||
end
|
end
|
||||||
|
|
||||||
def method_missing(called, *args, &block)
|
def method_missing(called, *args, **options, &block)
|
||||||
tag_string(called, *args, &block)
|
tag_string(called, *args, **options, &block)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -82,14 +82,14 @@ def translate(key, options = {})
|
|||||||
html_safe_options[name] = ERB::Util.html_escape(value.to_s)
|
html_safe_options[name] = ERB::Util.html_escape(value.to_s)
|
||||||
end
|
end
|
||||||
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)
|
if translation.respond_to?(:map)
|
||||||
translation.map { |element| element.respond_to?(:html_safe) ? element.html_safe : element }
|
translation.map { |element| element.respond_to?(:html_safe) ? element.html_safe : element }
|
||||||
else
|
else
|
||||||
translation.respond_to?(:html_safe) ? translation.html_safe : translation
|
translation.respond_to?(:html_safe) ? translation.html_safe : translation
|
||||||
end
|
end
|
||||||
else
|
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
|
end
|
||||||
rescue I18n::MissingTranslationData => e
|
rescue I18n::MissingTranslationData => e
|
||||||
if remaining_defaults.present?
|
if remaining_defaults.present?
|
||||||
|
@ -62,7 +62,7 @@ def form_text(action = "http://www.example.com", local: false, **options)
|
|||||||
end
|
end
|
||||||
|
|
||||||
def whole_form(action = "http://www.example.com", options = {})
|
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?
|
if block_given?
|
||||||
out << yield << "</form>"
|
out << yield << "</form>"
|
||||||
@ -168,7 +168,7 @@ def test_form_with_with_block_in_erb_and_local_true
|
|||||||
end
|
end
|
||||||
|
|
||||||
class FormWithActsLikeFormForTest < FormWithTest
|
class FormWithActsLikeFormForTest < FormWithTest
|
||||||
def form_with(*)
|
def form_with(*, **)
|
||||||
@output_buffer = super
|
@output_buffer = super
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -368,7 +368,7 @@ def test_word_wrap_with_leading_spaces
|
|||||||
def test_word_wrap_does_not_modify_the_options_hash
|
def test_word_wrap_does_not_modify_the_options_hash
|
||||||
options = { line_width: 15 }
|
options = { line_width: 15 }
|
||||||
passed_options = options.dup
|
passed_options = options.dup
|
||||||
word_wrap("some text", passed_options)
|
word_wrap("some text", **passed_options)
|
||||||
assert_equal options, passed_options
|
assert_equal options, passed_options
|
||||||
end
|
end
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user