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

Popular posts from this blog

Detect support for Shoutcast ICY MP3 without navigator.userAgent in Firefox? -

web - SVG not rendering properly in Firefox -

java - JavaFX 2 slider labelFormatter not being used -