refactor if / else to ||=

This commit is contained in:
Aaron Patterson
2010-08-18 23:37:11 -07:00
parent 6fb6ddb9a7
commit a16ec2f4cf

View File

@@ -93,11 +93,7 @@ module ActiveRecord
# #connection can be called any number of times; the connection is
# held in a hash keyed by the thread id.
def connection
if conn = @reserved_connections[current_connection_id]
conn
else
@reserved_connections[current_connection_id] = checkout
end
@reserved_connections[current_connection_id] ||= checkout
end
# Signal that the thread is finished with the current connection.