Permalink
Browse files

Don't use Active Support where we don't need to

  • Loading branch information...
1 parent 2fd0955 commit bdb8bc6e8a4ec3b11658935de9ae5d6a06630b81 @rafaelfranca rafaelfranca committed Nov 9, 2013
@@ -491,7 +491,7 @@ def exec_stmt(sql, name, binds)
end
begin
- stmt.execute(*type_casted_binds.map(&:second))
+ stmt.execute(*type_casted_binds.map { |_, val| val })
rescue Mysql::Error => e
# Older versions of MySQL leave the prepared statement in a bad
# place when an error occurs. To support older mysql versions, we
@@ -788,7 +788,7 @@ def exec_cache(sql, name, binds)
}
log(sql, name, type_casted_binds, stmt_key) do
- @connection.send_query_prepared(stmt_key, type_casted_binds.map(&:second))
+ @connection.send_query_prepared(stmt_key, type_casted_binds.map { |_, val| val })
@connection.block
@connection.get_last_result
end
@@ -310,7 +310,7 @@ def exec_query(sql, name = nil, binds = [])
stmt = cache[:stmt]
cols = cache[:cols] ||= stmt.columns
stmt.reset!
- stmt.bind_params type_casted_binds.map(&:second)
+ stmt.bind_params type_casted_binds.map { |_, val| val }
end
ActiveRecord::Result.new(cols, stmt.to_a)

2 comments on commit bdb8bc6

Member

amatsuda replied Nov 9, 2013

Symbol#to_proc is not indeed from AS. It's in Ruby today (since 1.8.7).

Owner

rafaelfranca replied Nov 9, 2013

But #second is, and this is what I want to avoid. 😄

Please sign in to comment.