class Ransack::Predicate

def detect_from_string(str, chomp: false)

def detect_from_string(str, chomp: false)
  return unless str
  Ransack.predicates.sorted_names_with_underscores.each do |predicate, underscored|
    if str.end_with? underscored
      str.chomp! underscored if chomp
      return predicate
    end
  end
  nil
end