Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@hotchpotch
Created August 21, 2012 01:57
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • 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