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

Fixes devils issue #666 #670

Closed
wants to merge 12 commits into from
7 changes: 4 additions & 3 deletions lib/cancan/model_adapters/active_record_5_adapter.rb
Original file line number Diff line number Diff line change
Expand Up @@ -46,9 +46,10 @@ def sanitize_sql_activerecord5(conditions)
table_metadata = ActiveRecord::TableMetadata.new(@model_class, table)
predicate_builder = ActiveRecord::PredicateBuilder.new(table_metadata)

conditions = predicate_builder.resolve_column_aliases(conditions)

conditions.stringify_keys!
unless self.class.version_greater_or_equal?('6.1.0')
conditions = predicate_builder.resolve_column_aliases(conditions)
conditions.stringify_keys!
end

predicate_builder.build_from_hash(conditions).map { |b| visit_nodes(b) }.join(' AND ')
end
Expand Down