Added ActiveRecord::Base.transaction to speed up.
This commit is contained in:
parent
9adc5d618f
commit
8f3d57c0ae
1 changed files with 6 additions and 4 deletions
|
@ -173,7 +173,7 @@ returns
|
||||||
|
|
||||||
merge model references to other model
|
merge model references to other model
|
||||||
|
|
||||||
result = Models.merge('User', 2, 4711)
|
result = Models.merge('User', 2, 4711) # Object, object_id_of_primary, object_id_which_should_be_merged
|
||||||
|
|
||||||
returns
|
returns
|
||||||
|
|
||||||
|
@ -209,9 +209,11 @@ returns
|
||||||
}
|
}
|
||||||
|
|
||||||
# update items
|
# update items
|
||||||
items_to_update.each {|_id, item|
|
ActiveRecord::Base.transaction do
|
||||||
item.save
|
items_to_update.each {|_id, item|
|
||||||
}
|
item.save
|
||||||
|
}
|
||||||
|
end
|
||||||
}
|
}
|
||||||
true
|
true
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in a new issue