wheresdave
2007-Aug-10 00:09 UTC
unitialized constant error when running migrate to load test data
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 --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---