Skip to content

Instantly share code, notes, and snippets.

@hotchpotch
Created August 21, 2012 01:57
Show Gist options
  • Save hotchpotch/3410567 to your computer and use it in GitHub Desktop.
Save hotchpotch/3410567 to your computer and use it in GitHub Desktop.
def destroy_all(conditions = nil)
if conditions
where(conditions).destroy_all
else
to_a.each {|object| object.destroy }.tap { reset }
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment