class Ransack::Adapters::ActiveRecord::Context

def attribute_method?(str, klass = @klass)

def attribute_method?(str, klass = @klass)
  exists = false
  if ransackable_attribute?(str, klass)
    exists = true
  elsif (segments = str.split(Constants::UNDERSCORE)).size > 1
    remainder = []
    found_assoc = nil
    while !found_assoc && remainder.unshift(segments.pop) &&
    segments.size > 0 do
      assoc, poly_class = unpolymorphize_association(
        segments.join(Constants::UNDERSCORE)
        )
      if found_assoc = get_association(assoc, klass)
        exists = attribute_method?(
          remainder.join(Constants::UNDERSCORE),
          poly_class || found_assoc.klass
          )
      end
    end
  end
  exists
end