ruby on rails - Efficient way to Add/Update or Delete with RoR -
i need loop through series of updates either involve adding / updating record, or removing it. updates need carried out in order, couldn't bulk delete @ end.
is there efficient / quick way achieve through rails.
currently i'm envisaging looping through updates. if it's delete request, deleting it. if it's not, searching it. if exists, updating. if doesn't, adding.
i don't think, when dealing thousands of updates, going pleasant wondering if there more efficient way go process?
you can try destroy_all
delete_all
update_all
conditions/scopes like:
user.where(:active => false).destroy_all
Comments
Post a Comment