Skip to content

Commit

Permalink
Implement hash equality on column
Browse files Browse the repository at this point in the history
The query cache uses bind values as hash keys. The current
implementation relies on reference equality for hash equality. This is
brittle, and can easily break in the future.
  • Loading branch information
sgrif committed Oct 28, 2014
1 parent 7943764 commit e13ac30
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions activerecord/lib/active_record/connection_adapters/column.rb
Expand Up @@ -64,6 +64,11 @@ def ==(other)
other.sql_type == sql_type &&
other.null == null
end
alias :eql? :==

def hash
[self.class, name, default, cast_type, sql_type, null].hash
end
end
end
# :startdoc:
Expand Down

0 comments on commit e13ac30

Please sign in to comment.