
Deciding on order that seed files are run
Reported by Asfand Yar Qazi | June 11th, 2009 @ 02:13 AM
Hi,
So I've got the typical set up of a model that belongs_to several others (i.e. has the foreign keys for the other models).
So there's y and z which don't need anything; but A requires and y_id and z_id.
in a.rb I'm trying to do:
record.y = Y.find_by_name('blah')
record.z = Z.find_by_name('blah')
It always loads up a.rb FIRST, when I want it loaded up after y and z. I tried renaming them to 10-y.rb, 20-z.rb and 30-a.rb hoping that would let me define the ordering - but it doesn't. Any ideas?
Thanks
Comments and changes to this ticket
-
david.mh.tong (at gmail) August 27th, 2009 @ 10:17 AM
- Assigned user cleared.
I prefix my rb files that are depended on by other rb files with numbers.
e.g.
000_square.rb
.rb rectangle_relies_on_square_and_on_triangle.rb
Please Sign in or create a free account to add a new ticket.
With your very own profile, you can contribute to projects, track your activity, watch tickets, receive and update tickets through your email and much more.
Create your profile
Help contribute to this project by taking a few moments to create your personal profile. Create your profile ยป
An attempt to simplify the usage of seed data in Rails applications through a dead simple API.