Hey guys, Is there an easy way for me to take my test fixtures and pop them into my development database? I really don''t want to use the interface to populate the database... it takes too much time. Adam
On Thu, 2005-11-17 at 13:31 -0800, Adam van den Hoven wrote:> Hey guys, > > Is there an easy way for me to take my test fixtures and pop them > into my development database? I really don''t want to use the > interface to populate the database... it takes too much time. > > AdamIndeed... in one of our recent projects, Jeremy added this as a development task: # lib/tasks/development.rake desc ''Load fixtures into the development database for convenience.'' task :development => [:environment] do require ''active_record/fixtures'' Fixtures.create_fixtures "#{RAILS_ROOT}/test/fixtures", %w( languages projects translations ) end rake development. Voila. :-) -Robby -- /****************************************************** * Robby Russell, Founder.Developer.Geek * PLANET ARGON, Rails Development, Consulting & Hosting * Portland, Oregon | p: 503.351.4730 | f: 815.642.4068 * www.planetargon.com | www.robbyonrails.com * Programming Rails | www.programmingrails.com *******************************************************/
On 11/17/05, Robby Russell <robby.lists-/Lcn8Y7Ot69QmPsQ1CNsNQ@public.gmane.org> wrote:> On Thu, 2005-11-17 at 13:31 -0800, Adam van den Hoven wrote: > > Hey guys, > > > > Is there an easy way for me to take my test fixtures and pop them > > into my development database? I really don''t want to use the > > interface to populate the database... it takes too much time. > > > > Adam > > Indeed... in one of our recent projects, Jeremy added this as a > development task: > > # lib/tasks/development.rake > > desc ''Load fixtures into the development database for convenience.'' > task :development => [:environment] do > require ''active_record/fixtures'' > Fixtures.create_fixtures "#{RAILS_ROOT}/test/fixtures", > %w( languages projects translations ) > end > > rake development. > > Voila. :-)And if it''s not clear, the languages, projects, and translations are the fixtures that should be loaded into the development database.
> Indeed... in one of our recent projects, Jeremy added this as a > development task: > > # lib/tasks/development.rake > > desc ''Load fixtures into the development database for convenience.'' > task :development => [:environment] do > require ''active_record/fixtures'' > Fixtures.create_fixtures "#{RAILS_ROOT}/test/fixtures", > %w( languages projects translations ) > end > > rake development. > > Voila. :-)That''s nice, but there''s already rake load_fixtures for that :) -- rick http://techno-weenie.net
Indeed so much has changed, and that task has a history dating back to the first RailsDay. I find variations on that theme to be useful for importing just certain fixtures, however, such as country or language data that are needed to initialize a system... it lets you take what you need. On Nov 17, 2005, at 4:14 PM, Rick Olson wrote:>> Indeed... in one of our recent projects, Jeremy added this as a >> development task: >> >> # lib/tasks/development.rake >> >> desc ''Load fixtures into the development database for convenience.'' >> task :development => [:environment] do >> require ''active_record/fixtures'' >> Fixtures.create_fixtures "#{RAILS_ROOT}/test/fixtures", >> %w( languages projects translations ) >> end >> >> rake development. >> >> Voila. :-) > > That''s nice, but there''s already rake load_fixtures for that :) > > -- > rick > http://techno-weenie.net > _______________________________________________ > Rails mailing list > Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org > http://lists.rubyonrails.org/mailman/listinfo/rails/****************************************************** * Robby Russell, Founder.Developer.Geek * PLANET ARGON, Rails Development, Consulting & Hosting * Portland, Oregon | p: 503.351.4730 | f: 815.642.4068 * www.planetargon.com | www.jvoorhis.com * Refactoring Rails | www.refactoringrails.com *******************************************************/ Also Cokemachineglow | www.cokemachineglow.com
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 Rick Olson wrote:> That''s nice, but there''s already rake load_fixtures for that :)How about the otherdirection: I have some test dat I want to put in a yaml file, but don''t want to type it all... - -- David Morton Maia Mailguard - http://www.maiamailguard.com Morton Software Design and Consulting - http://www.dgrmm.net -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.2 (MingW32) Comment: Using GnuPG with Thunderbird - http://enigmail.mozdev.org iD8DBQFDfhu4SIxC85HZHLMRAiRAAJ9pAiju1amH37z2zbHyILJSoTl2dACfV7wD qfWZfLqAyG5PuMGs81y7C9Q=7JHs -----END PGP SIGNATURE-----