Deprecation warning in remove_attachment plugin


I am getting a deprecation warning in RemoveAttachment plugin remove? method.

def remove?
  remove && remove != "" && remove !~ /\A(0|false)\z/

warning: deprecated Object#=~ is called on TrueClass; it always returns nil

Please suggest what can I do to fix this.


If you want to continue using the string comparison, you could cast remove.to_s and then run that on it. Or you could compare it with true using eql?.

Edit: Fixed the issue by passing in string rather than a boolean