Skip to content

Instantly share code, notes, and snippets.

@june29
Created December 20, 2011 12:00
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save june29/1501347 to your computer and use it in GitHub Desktop.
Save june29/1501347 to your computer and use it in GitHub Desktop.
config.active_record.observers breaks rake tasks
class User < ActiveRecord::Base
end
class UserObserver < ActiveRecord::Observer
end
module Tmp
class Application < Rails::Application
#...
config.active_record.observers = :user_observer
#...
end
end
$ rake user:count
rake aborted!
Expected app/models/user.rb to define User
GIT
remote: git://github.com/rails/rails.git
revision: 45e85c358d07b90fc52136c51a4511158e51849e
specs:
actionmailer (3.2.0.rc1)
actionpack (= 3.2.0.rc1)
mail (~> 2.3.0)
actionpack (3.2.0.rc1)
activemodel (= 3.2.0.rc1)
activesupport (= 3.2.0.rc1)
builder (~> 3.0.0)
erubis (~> 2.7.0)
journey (~> 1.0.0.rc1)
rack (~> 1.3.5)
rack-cache (~> 1.1)
rack-test (~> 0.6.1)
sprockets (~> 2.1.2)
activemodel (3.2.0.rc1)
activesupport (= 3.2.0.rc1)
builder (~> 3.0.0)
activerecord (3.2.0.rc1)
activemodel (= 3.2.0.rc1)
activesupport (= 3.2.0.rc1)
arel (~> 3.0.0.rc1)
tzinfo (~> 0.3.29)
activeresource (3.2.0.rc1)
activemodel (= 3.2.0.rc1)
activesupport (= 3.2.0.rc1)
activesupport (3.2.0.rc1)
i18n (~> 0.6)
multi_json (~> 1.0)
rails (3.2.0.rc1)
actionmailer (= 3.2.0.rc1)
actionpack (= 3.2.0.rc1)
activerecord (= 3.2.0.rc1)
activeresource (= 3.2.0.rc1)
activesupport (= 3.2.0.rc1)
bundler (~> 1.0)
railties (= 3.2.0.rc1)
railties (3.2.0.rc1)
actionpack (= 3.2.0.rc1)
activesupport (= 3.2.0.rc1)
rack-ssl (~> 1.3.2)
rake (>= 0.8.7)
rdoc (~> 3.4)
thor (~> 0.14.6)
GEM
remote: http://rubygems.org/
specs:
ansi (1.4.1)
arel (3.0.0.rc1)
builder (3.0.0)
coffee-rails (3.2.0)
coffee-script (>= 2.2.0)
railties (~> 3.2.0.beta)
coffee-script (2.2.0)
coffee-script-source
execjs
coffee-script-source (1.2.0)
erubis (2.7.0)
execjs (1.2.13)
multi_json (~> 1.0)
hike (1.2.1)
i18n (0.6.0)
journey (1.0.0.rc1)
jquery-rails (1.0.19)
railties (~> 3.0)
thor (~> 0.14)
json (1.6.3)
mail (2.3.0)
i18n (>= 0.4.0)
mime-types (~> 1.16)
treetop (~> 1.4.8)
mime-types (1.17.2)
multi_json (1.0.4)
polyglot (0.3.3)
rack (1.3.5)
rack-cache (1.1)
rack (>= 0.4)
rack-ssl (1.3.2)
rack
rack-test (0.6.1)
rack (>= 1.0)
rake (0.9.2.2)
rdoc (3.12)
json (~> 1.4)
sass (3.1.12)
sass-rails (3.2.1)
railties (~> 3.2.0.beta)
sass (>= 3.1.10)
tilt (~> 1.3)
sprockets (2.1.2)
hike (~> 1.2)
rack (~> 1.0)
tilt (~> 1.1, != 1.3.0)
sqlite3 (1.3.5)
thor (0.14.6)
tilt (1.3.3)
treetop (1.4.10)
polyglot
polyglot (>= 0.3.1)
turn (0.8.3)
ansi
tzinfo (0.3.31)
uglifier (1.2.0)
execjs (>= 0.3.0)
multi_json (>= 1.0.2)
PLATFORMS
ruby
DEPENDENCIES
coffee-rails
jquery-rails
rails!
sass-rails
sqlite3
turn
uglifier
namespace :user do
desc "count user"
task :count => :environment do
p User.count
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment