Permalink
Browse files

Added load_fixtures task to the Rakefile, which will load all the fix…

…tures into the database for the current environment #1791 [Marcel Molina]

git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@1879 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
  • Loading branch information...
dhh committed Jul 22, 2005
1 parent 1aab0e2 commit 9b0b66b7b7d220ab17c77d508e532ee21ba230a7
Showing with 12 additions and 1 deletion.
  1. +2 −0 railties/CHANGELOG
  2. +10 −1 railties/fresh_rakefile
View
@@ -1,5 +1,7 @@
*SVN*
+* Added load_fixtures task to the Rakefile, which will load all the fixtures into the database for the current environment #1791 [Marcel Molina]
+
* Added an empty robots.txt to public/, so that web servers asking for it won't trigger a dynamic call, like favicon.ico #1738 [michael@schubert]
* Dropped the 'immediate close-down' of FCGI processes since it didn't work consistently and produced bad responses when it didn't. So now a TERM ensures exit after the next request (just as if the process is handling a request when it receives the signal). This means that you'll have to 'nudge' all FCGI processes with a request in order to ensure that they have all reloaded. This can be done by something like ./script/process/repear --nudge 'http://www.myapp.com' --instances 10, which will load the myapp site 10 times (and thus hit all of the 10 FCGI processes once, enough to shut down).
View
@@ -199,4 +199,13 @@ end
desc "Migrate the database according to the migrate scripts in db/migrate (only supported on PG/MySQL). A specific version can be targetted with VERSION=x"
task :migrate => :environment do
ActiveRecord::Migrator.migrate(File.dirname(__FILE__) + '/db/migrate/', ENV["VERSION"] ? ENV["VERSION"].to_i : nil)
-end
+end
+
+desc "Load fixtures into the current environment's database"
+task :load_fixtures => :environment do
+ require 'active_record/fixtures'
+ ActiveRecord::Base.establish_connection(RAILS_ENV.to_sym)
+ Dir.glob(File.join(RAILS_ROOT, 'test', 'fixtures', '*.yml')).each do |fixture_file|
+ Fixtures.create_fixtures('test/fixtures', File.basename(fixture_file, '.*'))
+ end
+end

0 comments on commit 9b0b66b

Please sign in to comment.