rroblak/seed_dump

Dump id in addition to other attributes

mchenja opened this issue · 1 comments

I just heard about this gem, and even though I've been using it for less than ten minutes, it looks really useful.

However, I can't quite figure out how to dump the (hidden) "id" attribute that Rails adds to models. I suppose that isn't a problem for most people, since Rails enables "auto-increment" on the ids by default, but for me it's very important to have the exact same id when importing/exporting the database from seeds.rb.

Is such a thing possible with your gem?

Hey, thanks for using Seed Dump!

You can omit id from the exclude option to dump out the id attribute. By default exclude contains [:id, :created_at, :updated_at], but it's easy to override. For example:

# If we want to dump :id, but still filter out :created_at and :updated_at
rake db:seed:dump EXCLUDE=created_at,updated_at