I'm working on a hack to preload fixtures, and decided that
test_helper.rb was the best place to do this. I define a method and
then call it right away.
In brief, this method runs rake/shell tasks using ยดยด (bad approach, I
know.. - suggestions?), i.e.:
def preload_fixtures
dump my dev db ddl
`rake db:test:purge`
load the test db with all ddl except FKs
`rake db:fixtures:load RAILS_ENV=test`
load the FKs
end
preload_fixtures()
However, step #2 fails, as the purge task for postgres works by
dropping and recreating the db, which can't be done while there's an
open connection to it.
I've tried calling ActiveRecord::Base.connection.disconnect! right
before running the purge task, to no avail. I figure the connection
may not even be using AR..
Anyone familiar enough with the workings here to give some advice?
This is all very fragile and platform dependant anyway, so path of
least resistance is preferred, don't worry about cleanliness.. ;) --
The various plugins for specifying fixture load order are _not_ an
option, though.
Thanks in advance,
Isak
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Ruby on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@googlegroups.com
To unsubscribe from this group, send email to
rubyonrails-talk-unsubscribe@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---