Skip to content

Commit

Permalink
Restore require of 'active_record/fixtures' for Rake tasks that use them
Browse files Browse the repository at this point in the history
  • Loading branch information
packagethief committed Jan 6, 2010
1 parent 894ce15 commit caad6c6
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions activerecord/lib/active_record/railties/databases.rake
Expand Up @@ -245,6 +245,8 @@ namespace :db do
namespace :fixtures do
desc "Load fixtures into the current environment's database. Load specific fixtures using FIXTURES=x,y. Load from subdirectory in test/fixtures using FIXTURES_DIR=z. Specify an alternative path (eg. spec/fixtures) using FIXTURES_PATH=spec/fixtures."
task :load => :environment do
require 'active_record/fixtures'

ActiveRecord::Base.establish_connection(Rails.env)
base_dir = ENV['FIXTURES_PATH'] ? File.join(Rails.root, ENV['FIXTURES_PATH']) : File.join(Rails.root, 'test', 'fixtures')
fixtures_dir = ENV['FIXTURES_DIR'] ? File.join(base_dir, ENV['FIXTURES_DIR']) : base_dir
Expand All @@ -256,6 +258,8 @@ namespace :db do

desc "Search for a fixture given a LABEL or ID. Specify an alternative path (eg. spec/fixtures) using FIXTURES_PATH=spec/fixtures."
task :identify => :environment do
require 'active_record/fixtures'

label, id = ENV["LABEL"], ENV["ID"]
raise "LABEL or ID required" if label.blank? && id.blank?

Expand Down

0 comments on commit caad6c6

Please sign in to comment.