Skip to content
This repository has been archived by the owner on Mar 30, 2022. It is now read-only.

Commit

Permalink
Backwards compatibility fix for Active Record 4.1
Browse files Browse the repository at this point in the history
Checks the size of the changed method to determine which arguments to
provide.
  • Loading branch information
danielrhodes authored and Daniel Rhodes committed Jan 8, 2015
1 parent 7d4fca1 commit e7f0168
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion lib/squeel/adapters/active_record/4.2/relation_extensions.rb
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,12 @@ def where_values_hash_with_squeel(relation_table_name = table_name)
def expand_attrs_from_hash(opts)
opts = ::ActiveRecord::PredicateBuilder.resolve_column_aliases(klass, opts)

tmp_opts, bind_values = create_binds(opts)
bind_args = [opts]
# Active Record 4.1 compatibility
# (for commits before 08579e4078454c6058f1289b58bf5bfa26661376 - https://github.com/rails/rails/commit/08579e4078454c6058f1289b58bf5bfa26661376)
bind_args << bind_values.length if method(:create_binds).arity > 1
tmp_opts, bind_values = create_binds(*bind_args)

self.bind_values += bind_values

attributes = @klass.send(:expand_hash_conditions_for_aggregates, tmp_opts)
Expand Down

0 comments on commit e7f0168

Please sign in to comment.