Fix untested code path
This commit is contained in:
parent
658d49393a
commit
329ba57fba
|
@ -728,8 +728,8 @@ SQL
|
||||||
if string.gsub(/[ _]/, '') =~ /^-?\d+$/
|
if string.gsub(/[ _]/, '') =~ /^-?\d+$/
|
||||||
clazz_name = (/^(.*)_id$/.match(type.to_s)[1].classify.to_sym)
|
clazz_name = (/^(.*)_id$/.match(type.to_s)[1].classify.to_sym)
|
||||||
begin
|
begin
|
||||||
Object.const_get(clazz_name).find(string.gsub(/[ _]/, '').to_i)
|
object = Object.const_get(clazz_name).with_deleted.find(string.gsub(/[ _]/, '').to_i)
|
||||||
value = pkey
|
value = object.id
|
||||||
rescue ActiveRecord::RecordNotFound
|
rescue ActiveRecord::RecordNotFound
|
||||||
invalid_format string, "The specified #{clazz_name} was not found"
|
invalid_format string, "The specified #{clazz_name} was not found"
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in New Issue