Skip to content

Instantly share code, notes, and snippets.

View jules2689's full-sized avatar

Julian Nadeau jules2689

View GitHub Profile
@jules2689
jules2689 / db_fixtures_dump.rake
Last active September 30, 2019 18:49 — forked from ecleel/db_fixtures_dump.rake
Rails 6: Dump Rails db to fixtures
# Original from http://snippets.dzone.com/posts/show/4468 by MichaelBoutros
# Forked from https://gist.github.com/ecleel/3dc89a753bac6a54bf8d170f63256f19
#
# Optimized version which uses to_yaml for content creation and checks
# that models are ActiveRecord::Base models and not abstract class before trying to fetch
# them from database.
#
# Also supports nested resources and namespaces them correctly
#
# Tested in Rails 6.0.0