[Rails] Loading data with fixtures
Tim Bates
tim at bates.id.au
Thu Mar 3 07:23:40 GMT 2005
Timothy Myrtle wrote:
> Can anyone point me to an easy way to load fixture
> data into the development (not test) database?
I added the following to my Rakefile:
desc "Load fixtures data into the development database"
task :load_fixtures_data_to_development do
require 'active_record/fixtures'
ActiveRecord::Base.establish_connection(
ActiveRecord::Base.configurations["development"])
Fixtures.create_fixtures("test/fixtures",
ActiveRecord::Base.configurations[:fixtures_load_order])
end
I've defined configurations[:fixtures_load_order] in my environment.rb
since this is also used by similar code in my test suite to load the
fixutures in the correct order, since I have foreign key constraints to
satisfy.
Tim.
--
Tim Bates
tim at bates.id.au
More information about the Rails
mailing list