Skip to content

Instantly share code, notes, and snippets.

.__ ___. .__ __ .__ .___
| |__ _____ ______ ______ ___.__. \_ |__ |__|_______ _/ |_ | |__ __| _/_____ ___.__.
| | \ \__ \ \____ \ \____ \< | | | __ \ | |\_ __ \\ __\| | \ / __ | \__ \ < | |
| Y \ / __ \_| |_> >| |_> >\___ | | \_\ \| | | | \/ | | | Y \/ /_/ | / __ \_\___ |
|___| /(____ /| __/ | __/ / ____| |___ /|__| |__| |__| |___| /\____ | (____ // ____|
\/ \/ |__| |__| \/ \/ \/ \/ \/ \/
_____ ___ ___ ___ ___ ___
/ /::\ / /\ / /\ /__/\ /__/\ /__/| ___
/ /:/\:\ / /:/_ / /:/_ \ \:\ \ \:\ | |:| / /\
/ /:/ \:\ / /:/ /\ / /:/ /\ \ \:\ \ \:\ | |:| / /:/
@dustin
dustin / gist:41462
Created December 30, 2008 00:48 — forked from damon/gist:41453
def whack(objects)
Hash[*objects.map{|o| [o.send('table_name'), o.send('delete_all')]}.flatten]
end
# or (depending on what "send" means there)
def whack(objects)
Hash[*objects.map{|o| [o.table_name, o.delete_all]}.flatten]
end
# moved to http://gist.github.com/41462
def whack(objects)
Hash[ *objects.map{|o| [o.send('table_name'), o.send('delete_all')]}.flatten]
end