123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
|
# File 'lib/mls.rb', line 123
def find_some(ids)
friendly = -> (id) { id.respond_to?(:to_i) && id.to_i.to_s != id.to_s }
return super if !ids.all? { |x| friendly.call(x) }
result = where(table['slug'].in(ids)).to_a
expected_size =
if limit_value && ids.size > limit_value
limit_value
else
ids.size
end
if offset_value && (ids.size - offset_value < expected_size)
expected_size = ids.size - offset_value
end
if result.size == expected_size
result
else
raise_record_not_found_exception!(ids, result.size, expected_size)
end
end
|