Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Revert a change made in 2014 that prevent Ransack from finding the co… #1051

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
12 changes: 6 additions & 6 deletions lib/ransack/adapters/active_record/context.rb
Original file line number Diff line number Diff line change
Expand Up @@ -25,13 +25,13 @@ def relation_for(object)

def type_for(attr)
return nil unless attr && attr.valid?
name = attr.arel_attribute.name.to_s
table = attr.arel_attribute.relation.table_name
schema_cache = ::ActiveRecord::Base.connection.schema_cache
unless schema_cache.send(database_table_exists?, table)
raise "No table named #{table} exists."
name = attr.arel_attribute.name.to_s
table = attr.arel_attribute.relation.table_name
connection = attr.klass.connection
unless connection.table_exists?(table)
raise "No table named #{table} exists"
end
schema_cache.columns_hash(table)[name].type
connection.schema_cache.columns_hash(table)[name].type
end

def evaluate(search, opts = {})
Expand Down