Skip to content

Commit

Permalink
Fix Rails 6.1 validations by Adding ** to call. (#48)
Browse files Browse the repository at this point in the history
* Adding ** to call.
  • Loading branch information
adrianmann authored and ssinghi committed Oct 13, 2022
1 parent 79af053 commit c856522
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ def validate_blacklist(record, attribute, value)
end

def mark_invalid(record, attribute, types)
record.errors.add attribute, :invalid, options.merge(types: types.join(", "))
record.errors.add attribute, :invalid, **options.merge(types: types.join(", "))
end

def allowed_types
Expand Down
2 changes: 1 addition & 1 deletion lib/paperclip/validators/attachment_file_name_validator.rb
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ def validate_blacklist(record, attribute, value)
end

def mark_invalid(record, attribute, patterns)
record.errors.add attribute, :invalid, options.merge(names: patterns.join(", "))
record.errors.add attribute, :invalid, **options.merge(names: patterns.join(", "))
end

def allowed
Expand Down
2 changes: 1 addition & 1 deletion lib/paperclip/validators/attachment_presence_validator.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ module Paperclip
module Validators
class AttachmentPresenceValidator < ActiveModel::EachValidator
def validate_each(record, attribute, _value)
record.errors.add(attribute, :blank, options) if record.send("#{attribute}_file_name").blank?
record.errors.add(attribute, :blank, **options) if record.send("#{attribute}_file_name").blank?
end

def self.helper_method_name
Expand Down
2 changes: 1 addition & 1 deletion lib/paperclip/validators/attachment_size_validator.rb
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ def validate_each(record, attr_name, value)
unless value.send(CHECKS[option], option_value)
error_message_key = options[:in] ? :in_between : option
error_attrs.each do |error_attr_name|
record.errors.add(error_attr_name, error_message_key, filtered_options(value).merge(
record.errors.add(error_attr_name, error_message_key, **filtered_options(value).merge(
min: min_value_in_human_size(record),
max: max_value_in_human_size(record),
count: human_size(option_value)
Expand Down

0 comments on commit c856522

Please sign in to comment.