Improved error handling.
This commit is contained in:
parent
e6fcd3c359
commit
9af5867b6f
1 changed files with 5 additions and 1 deletions
|
@ -89,8 +89,12 @@ returns
|
||||||
self.class.reflect_on_all_associations.map { |assoc|
|
self.class.reflect_on_all_associations.map { |assoc|
|
||||||
real_key = assoc.name.to_s[0,assoc.name.to_s.length-1] + '_ids'
|
real_key = assoc.name.to_s[0,assoc.name.to_s.length-1] + '_ids'
|
||||||
if params.has_key?( real_key.to_sym )
|
if params.has_key?( real_key.to_sym )
|
||||||
|
list_of_items = params[ real_key.to_sym ]
|
||||||
|
if params[ real_key.to_sym ].class != Array
|
||||||
|
list_of_items = [ params[ real_key.to_sym ] ]
|
||||||
|
end
|
||||||
list = []
|
list = []
|
||||||
params[ real_key.to_sym ].each {|item|
|
list_of_items.each {|item|
|
||||||
list.push( assoc.klass.find(item) )
|
list.push( assoc.klass.find(item) )
|
||||||
}
|
}
|
||||||
self.send( assoc.name.to_s + '=', list )
|
self.send( assoc.name.to_s + '=', list )
|
||||||
|
|
Loading…
Reference in a new issue