1
0
Fork 0
mirror of https://github.com/rails/rails.git synced 2022-11-09 12:12:34 -05:00

dont merge when you can update (closes #4529) [skaes]

git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@4116 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
This commit is contained in:
David Heinemeier Hansson 2006-04-01 06:57:43 +00:00
parent d08f838c0e
commit 5fd7118cbc

View file

@ -947,7 +947,7 @@ module ActiveRecord #:nodoc:
def find_one(id, options)
conditions = " AND (#{sanitize_sql(options[:conditions])})" if options[:conditions]
options = options.merge :conditions => "#{table_name}.#{primary_key} = #{sanitize(id)}#{conditions}"
options.update :conditions => "#{table_name}.#{primary_key} = #{sanitize(id)}#{conditions}"
if result = find_initial(options)
result
@ -959,7 +959,7 @@ module ActiveRecord #:nodoc:
def find_some(ids, options)
conditions = " AND (#{sanitize_sql(options[:conditions])})" if options[:conditions]
ids_list = ids.map { |id| sanitize(id) }.join(',')
options = options.merge :conditions => "#{table_name}.#{primary_key} IN (#{ids_list})#{conditions}"
options.update :conditions => "#{table_name}.#{primary_key} IN (#{ids_list})#{conditions}"
result = find_every(options)