FileSizeValidator is made more complex by allowing a symbol argument to its conditions

Currently we allow something like this:

class Note < ActiveRecord::Base
  validates :attachment, file_size: { maximum: :max_attachment_size }

  def max_attachment_size
    10.megabytes
  end
end

The FileSizeValidator will see that maximum is a symbol, and then call note_instance.public_send(:max_attachment_size).

Currently Note is the only thing that makes use of this condition, and it's for a field we've marked as deprecated.

This behavior makes the validation overly complex and it would be good to remove it if we can.

Assignee Loading
Time tracking Loading