Fixed generic object_lookup(). For Roy, 'refs 123'.
This commit is contained in:
parent
3525ad79a9
commit
f57e15e984
1 changed files with 5 additions and 4 deletions
|
@ -411,8 +411,9 @@ class Channel::EmailParser
|
||||||
def object_lookup( attributes, map, mail )
|
def object_lookup( attributes, map, mail )
|
||||||
map.each { |item|
|
map.each { |item|
|
||||||
if mail[ item[0].to_sym ]
|
if mail[ item[0].to_sym ]
|
||||||
if item[1].where( item[3].to_sym => mail[ item[0].to_sym ] ).first
|
new_object = item[1].where( "lower(#{item[3]}) = ?", mail[ item[0].to_sym ].downcase ).first
|
||||||
attributes[ item[2].to_sym ] = item[1].where( "lower(#{item[3]}) = ?", mail[ item[0].to_sym ].downcase ).first.id
|
if new_object
|
||||||
|
attributes[ item[2].to_sym ] = new_object.id
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue