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

Fix failing specs on local machine [fix #1023] #1024

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions lib/ransack/adapters/active_record/context.rb
Original file line number Diff line number Diff line change
Expand Up @@ -186,6 +186,8 @@ def extract_correlated_key(join_root)
correlated_key = correlated_key.left.left
elsif correlated_key.is_a? Arel::Nodes::Equality
correlated_key = correlated_key.left
elsif correlated_key.is_a? Arel::Nodes::Grouping
correlated_key = join_root.right.expr.right.left
else
correlated_key
end
Expand Down
4 changes: 2 additions & 2 deletions spec/ransack/search_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -238,9 +238,9 @@ module Ransack
real_query = remove_quotes_and_backticks(s.to_sql)

expect(real_query)
.to include "LEFT OUTER JOIN articles ON articles.person_id = people.id"
.to match(%r{LEFT OUTER JOIN articles ON (\('default_scope' = 'default_scope'\) AND )?articles.person_id = people.id})
expect(real_query)
.to include "LEFT OUTER JOIN articles articles_people ON articles_people.person_id = parents_people.id"
.to match(%r{LEFT OUTER JOIN articles articles_people ON (\('default_scope' = 'default_scope'\) AND )?articles_people.person_id = parents_people.id})
expect(real_query)
.to include "people.name = 'person_name_query'"
expect(real_query)
Expand Down