# Unitialized constant error when running migrate to load test

**URL:** <https://www.ruby-forum.com/t/unitialized-constant-error-when-running-migrate-to-load-test/111722>\
**Category:** Rails\
**Created:** [August 10, 2007, 2:10am UTC](https://www.ruby-forum.com/t/unitialized-constant-error-when-running-migrate-to-load-test/111722 "2007-08-10T02:10:20Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![wheresdave](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/w/6a8cbe/32.png) [@wheresdave](https://www.ruby-forum.com/u/wheresdave)\
**Post date:** [August 10, 2007, 2:10am UTC](https://www.ruby-forum.com/t/unitialized-constant-error-when-running-migrate-to-load-test/111722/1 "2007-08-10T02:10:20Z")

</div>

Hi gang,

Provided all the info below that i can think of. I am running instant  
rails on WinXP, but i dont see how that is an issue, I have been  
running rake commands for months with no issue. Also, I am running the  
rake command out of the root of the app e.g. \rails\_apps\puget

Thanx for your help.

* * *

the file is named sample\_data.rake  
it is saved in \railsapps\puget\lib\tasks

sample data is saved in \railsapps\puget\lib\tasks\sample\_data

command used for rake  
rake db:sample\_data:load

error message

rake aborted  
uninitialized constant ActiveRecord

pasted below sample\_data.rake

# Provide tasks to load and delete sample user data.

require ‘active\_record/fixtures’

namespace :db do  
DATA\_DIRECTORY = “#{RAILS\_ROOT}/lib/tasks/sample\_data”  
namespace :sample\_data do  
TABLES = %w(users specs faqs)  
MIN\_USER\_ID = 1000 # Starting user id for the sample data

```
desc "Load sample data"
task :load => :environment do |t|
  class_name = nil # Use nil to get Rails to figure out the

```

class.  
TABLES.each do |table\_name|  
fixture = Fixtures.new(ActiveRecord::Base.connection,  
table\_name, class\_name,  
File.join(DATA\_DIRECTORY,  
table\_name.to\_s))  
fixture.insert\_fixtures  
puts “Loaded data from #{table}.yml”  
end  
end

```
desc "Remove sample data"
task :delete => :environment do |t|
  User.delete_all("id >= #{MIN_USER_ID}")
  Spec.delete_all("user_id >= #{MIN_USER_ID}")
  Faq.delete_all( "user_id >= #{MIN_USER_ID}")
end

```

end  
end
