Skip to content

Commit

Permalink
Use ActiveModel for size file validatiom #Issue 120 (#122)
Browse files Browse the repository at this point in the history
  • Loading branch information
sbhawsingka authored Aug 15, 2023
1 parent edd1d9d commit 743979b
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions lib/paperclip/validators/attachment_size_validator.rb
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,8 @@ def validate_each(record, attr_name, value)
options.slice(*AVAILABLE_CHECKS).each do |option, option_value|
option_value = option_value.call(record) if option_value.is_a?(Proc)
option_value = extract_option_value(option, option_value)
operator = ActiveRecord::VERSION::MAJOR >= 7 ? COMPARE_CHECKS[option] : CHECKS[option]
operator = ActiveModel::VERSION::MAJOR >= 7 ? COMPARE_CHECKS[option] : CHECKS[option]

unless value.send(operator, option_value)
error_message_key = options[:in] ? :in_between : option
error_attrs.each do |error_attr_name|
Expand Down

0 comments on commit 743979b

Please sign in to comment.