uninitialized constant Class #28

Closed
gerbdla opened this Issue Jan 8, 2012 · 1 comment

Comments

Projects
None yet
2 participants

gerbdla commented Jan 8, 2012

I am getting this error
uninitialized constant Class::Tweet

This is my rake task
require 'big_sitemap'

include Rails.application.routes.url_helpers # Allows access to Rails routes

BigSitemap.generate(:url_options => {:host => 'mysite'}, :document_root => "#{Rails.root}/public") do

Add some URLs with additional options

Tweet.find(:all).each do |tweet|
add tweet_path(tweet), :change_frequency => 'daily', :priority => 0.5
end
end

gerbdla closed this Jan 10, 2012

Are you doing that within a rake task? If so, insert the "environment" through the block:
namespace :sitemap do
task :generate, [ :needs ] => [ :environment ] do
end
end

And now you're able to access the Twitter ActiveRecord class from your rails environment :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment