mirror of
https://github.com/rails/rails.git
synced 2022-11-09 12:12:34 -05:00
Restore require of 'active_record/fixtures' for Rake tasks that use them
This commit is contained in:
parent
894ce15534
commit
caad6c634c
1 changed files with 4 additions and 0 deletions
|
@ -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
|
||||
|
@ -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?
|
||||
|
||||
|
|
Loading…
Reference in a new issue