Don't duplicate predicate building logic in Relation finders
This commit is contained in:
parent
3ba9d32c6c
commit
50e7c013c0
@ -446,10 +446,7 @@ def find_one(id)
|
||||
MSG
|
||||
end
|
||||
|
||||
column = columns_hash[primary_key]
|
||||
substitute = connection.substitute_at(column, bind_values.length)
|
||||
relation = where(table[primary_key].eq(substitute))
|
||||
relation.bind_values += [[column, id]]
|
||||
relation = where(primary_key => id)
|
||||
record = relation.take
|
||||
|
||||
raise_record_not_found_exception!(id, 0, 1) unless record
|
||||
@ -458,7 +455,7 @@ def find_one(id)
|
||||
end
|
||||
|
||||
def find_some(ids)
|
||||
result = where(table[primary_key].in(ids)).to_a
|
||||
result = where(primary_key => ids).to_a
|
||||
|
||||
expected_size =
|
||||
if limit_value && ids.size > limit_value
|
||||
|
Loading…
Reference in New Issue
Block a user