Ignore empty relations.
This commit is contained in:
parent
e5647be022
commit
293468a6f1
1 changed files with 2 additions and 1 deletions
|
@ -92,7 +92,7 @@ returns
|
||||||
|
|
||||||
=begin
|
=begin
|
||||||
|
|
||||||
set rellations of model based on params
|
set relations of model based on params
|
||||||
|
|
||||||
model = Model.find(1)
|
model = Model.find(1)
|
||||||
result = model.param_set_associations(params)
|
result = model.param_set_associations(params)
|
||||||
|
@ -117,6 +117,7 @@ returns
|
||||||
end
|
end
|
||||||
list = []
|
list = []
|
||||||
list_of_items.each {|item|
|
list_of_items.each {|item|
|
||||||
|
next if !item
|
||||||
list.push(assoc.klass.find(item))
|
list.push(assoc.klass.find(item))
|
||||||
}
|
}
|
||||||
send(assoc.name.to_s + '=', list)
|
send(assoc.name.to_s + '=', list)
|
||||||
|
|
Loading…
Reference in a new issue