Skip to content

Instantly share code, notes, and snippets.

View nathansomething's full-sized avatar

Nathan Goodman nathansomething

View GitHub Profile
@nathansomething
nathansomething / db_fixtures_dump.rake
Created July 19, 2016 20:51 — forked from iiska/db_fixtures_dump.rake
Dump Rails db to fixtures
# Original from http://snippets.dzone.com/posts/show/4468 by MichaelBoutros
#
# Optimized version which uses to_yaml for content creation and checks
# that models are ActiveRecord::Base models before trying to fetch
# them from database.
namespace :db do
namespace :fixtures do
desc 'Dumps all models into fixtures.'
task :dump => :environment do
models = Dir.glob(RAILS_ROOT + '/app/models/**.rb').map do |s|