# Loading fixtures from different dir

**URL:** <https://www.ruby-forum.com/t/loading-fixtures-from-different-dir/122069>\
**Category:** Rails\
**Created:** [December 4, 2007, 10:15am UTC](https://www.ruby-forum.com/t/loading-fixtures-from-different-dir/122069 "2007-12-04T10:15:40Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![eggie5](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/e/7c8e57/32.png) [@eggie5](https://www.ruby-forum.com/u/eggie5)\
**Post date:** [December 4, 2007, 10:15am UTC](https://www.ruby-forum.com/t/loading-fixtures-from-different-dir/122069/1 "2007-12-04T10:15:40Z")

</div>

I have a set of fixtures in my db/bootstrap dir. anybody have any idea  
on how I can use rake db:fixtures:load with fixtures in a different  
dir?

---

<div class="post-metadata">

**Author:** ![eggie5](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/e/7c8e57/32.png) [@eggie5](https://www.ruby-forum.com/u/eggie5)\
**Post date:** [December 4, 2007, 6:56pm UTC](https://www.ruby-forum.com/t/loading-fixtures-from-different-dir/122069/2 "2007-12-04T18:56:19Z")

</div>

I ended up modifying the rails db:fixtures:load task:

namespace :db do  
namespace :bootstrap do  
namespace :fixtures do  
desc “Load fixtures into the current environment’s  
database. Load specific fixtures using FIXTURES=x,y”  
task :load =\> :environment do  
require ‘active\_record/fixtures’  
ActiveRecord::Base.establish\_connection(RAILS\_ENV.to\_sym)  
(ENV[‘FIXTURES’] ? ENV[‘FIXTURES’].split(/,/) :  
Dir.glob(File.join(RAILS\_ROOT, ‘db’, ‘bootstrap’, ‘_.  
{yml,csv}’))).each do |fixture\_file|  
Fixtures.create\_fixtures(‘db/bootstrap’,  
File.basename(fixture\_file, '._’))  
end  
end  
end  
end  
end

Looking at the code it makes me wonder if the rails version of  
Fixtures.create\_fixtures is windows compatible because of the unix  
path it uses for ‘test/fixtures’

Hmm…
