This project is archived and is in readonly mode.

#6493 new
Ludo van den Boom

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

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

Copied most of the info from ticket #5074. 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), 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

No comments found

Create your profile

Help contribute to this project by taking a few moments to create your personal profile. Create your profile »

<h2 style="font-size: 14px">Tickets have moved to Github</h2>

The new ticket tracker is available at <a href="https://github.com/rails/rails/issues">https://github.com/rails/rails/issues</a>

People watching this ticket

Attachments

Pages