Skip to content

Commit

Permalink
Fix Ruby 2.7 deprecations
Browse files Browse the repository at this point in the history
  • Loading branch information
tagliala committed Dec 25, 2019
1 parent e39288d commit c245b78
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 7 deletions.
8 changes: 4 additions & 4 deletions lib/client_side_validations/action_view/form_with_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ def form_with(model: nil, scope: nil, url: nil, format: nil, **options, &block)
if block_given?
form_tag_with_validators scope, model, options, url, &block
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
Expand All @@ -31,16 +31,16 @@ def check_model(url, model, format, scope)
[url, model, scope]
end

def form_tag_with_validators(scope, model, options, url)
def form_tag_with_validators(scope, model, options, url, &block)
@validators = {}

builder = instantiate_builder(scope, model, options)
output = capture(builder, &Proc.new)
output = capture(builder, &block)
options[:multipart] ||= builder.multipart?

build_bound_validators! options

html_options = html_options_for_form_with(url, model, options)
html_options = html_options_for_form_with(url, model, **options)

if model
html_options[:novalidate] ||= 'novalidate'
Expand Down
2 changes: 1 addition & 1 deletion lib/client_side_validations/active_model.rb
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ def check_new_record(validator)
end

def will_save_change?(options)
options =~ /changed\?/ || options =~ /will_save_change_to/
options.is_a?(Symbol) && (options.end_with?('changed?') || options.start_with?('will_save_change_to'))
end

def check_conditionals(attr, validator, force)
Expand Down
4 changes: 2 additions & 2 deletions test/action_view/cases/helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,11 @@ class Base
module ActionViewTestSetup
include ::ClientSideValidations::ActionView::Helpers::FormHelper

def form_for(*)
def form_for(*, **)
@output_buffer = super
end

def form_with(*)
def form_with(*, **)
@output_buffer = super
end

Expand Down

0 comments on commit c245b78

Please sign in to comment.