Permalink
Browse files

remove column_names_hashed, was causing rare test failures

  • Loading branch information...
1 parent cf79a08 commit 9785d2226d1d7e0251c37381fe937e8b367b4932 @sdsykes sdsykes committed Mar 30, 2009
Showing with 2 additions and 8 deletions.
  1. +2 −2 lib/optimizations/columns/attributes_proxy.rb
  2. +0 −6 lib/optimizations/columns/macro.rb
@@ -52,7 +52,7 @@ def keys
# Let #has_key? consider defined columns
#
def has_key?(attr_name)
- @klass.column_names_hashed.has_key?(attr_name.to_s)
+ @klass.column_names.include?(attr_name.to_s)
end
alias_method :include?, :has_key?
@@ -127,7 +127,7 @@ def fetch_remaining!( columns_to_fetch )
end
def interesting_for_scrooge?( attr_s )
- @klass.column_names_hashed.has_key?(attr_s) && !@scrooge_columns.include?(attr_s)
+ @klass.column_names.include?(attr_s) && !@scrooge_columns.include?(attr_s)
end
def augment_callsite!( attr_s )
@@ -65,12 +65,6 @@ def scope_with_scrooge?( sql )
sql =~ scrooge_select_regex &&
column_names.include?(self.primary_key.to_s) &&
sql !~ ScroogeRegexJoin
- end
-
- # far more efficient to search for a hash key than through an array
- #
- def column_names_hashed
- @column_names_hashed ||= column_names.inject({}) {|memo, cn| memo[cn] = true; memo}
end
private

0 comments on commit 9785d22

Please sign in to comment.