Lighthouse has a new layout. Prefer the old one? Return to the old layout, and switch back any time from the link at the top of each page.

This project is archived and is in readonly mode.

[PATCH] Constant loading when running rake task (expected x.rb to define X)

#6493

Copied most of the info from ticket #5074 observer bug. The problem I encounter is the same as in that ticket, except I don't have issues with rails console (that has already been resolved in ticket #5074 observer bug), but with running rake tasks. Attached patch resolves this issue for rake tasks as well.

Versions used

I am using Ruby 1.8.7 and Rails 3.0.5

Steps to reproduce

1) rails new foo
2) cd foo
3) rails generate model bar
4) rails generate observer bar
5) rake db:migrate
6) in config/application.rb file:

config.active_record.observers = :bar_observer

6) touch lib/tasks/qux.rake
7) in lib/tasks/qux.rake:

desc "Qux"
task :qux => :environment do
  Bar
end

8) rake qux

Results in an error:

Expected /Users/ludo/src/foo/app/models/bar.rb to define Bar

Reported by Ludo van den Boom · March 1st, 2011 @ 03:23 PM

State: new
Milestone: none
Assigned to: nobody
Importance: none

Activity

No comments yet.