Skip to content

Instantly share code, notes, and snippets.

View happy birthday, chris
.__ ___. .__ __ .__ .___
| |__ _____ ______ ______ ___.__. \_ |__ |__|_______ _/ |_ | |__ __| _/_____ ___.__.
| | \ \__ \ \____ \ \____ \< | | | __ \ | |\_ __ \\ __\| | \ / __ | \__ \ < | |
| Y \ / __ \_| |_> >| |_> >\___ | | \_\ \| | | | \/ | | | Y \/ /_/ | / __ \_\___ |
|___| /(____ /| __/ | __/ / ____| |___ /|__| |__| |__| |___| /\____ | (____ // ____|
\/ \/ |__| |__| \/ \/ \/ \/ \/ \/
_____ ___ ___ ___ ___ ___
/ /::\ / /\ / /\ /__/\ /__/\ /__/| ___
/ /:/\:\ / /:/_ / /:/_ \ \:\ \ \:\ | |:| / /\
/ /:/ \:\ / /:/ /\ / /:/ /\ \ \:\ \ \:\ | |:| / /:/
View gist:41462
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
View gist:41460
# moved to http://gist.github.com/41462
def whack(objects)
Hash[ *objects.map{|o| [o.send('table_name'), o.send('delete_all')]}.flatten]
end