RailsCasts Pro episodes are now free!

Learn more or hide this

Rob Dawson's Profile

GitHub User: rojotek

Site: http://www.rojotek.com/blog

Comments by Rob Dawson

Avatar

Hi Ryan,

I just came up with the following code to help ensure that you get consistent ID's when using the delete and repopulate seed approach.

ruby
Model.delete_all
Model.accessible_attributes<<"id"
Model.create([{id: 1, ...},
{id: 2, ...},
{id: 3, ...},
...
]
MessageType.accessible_attributes-["id"]