Forum: Ruby on Rails Problems with association named :task

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
Jason G. (Guest)
on 2006-03-13 18:48
I have an object that belongs_to :task, and calling that object's task
method returns the task it belongs to in the unit tests.  One place in a
controller, though, it gives me the error:
undefined method `find' for Rake::Task:Class
./script/../config/../vendor/rails/activerecord/lib/active_record/associations/belongs_to_association.rb:44:in
`find_target'
./script/../config/../vendor/rails/activerecord/lib/active_record/associations/association_proxy.rb:106:in
`load_target'
./script/../config/../vendor/rails/activerecord/lib/active_record/associations/association_proxy.rb:32:in
`reload'
./script/../config/../vendor/rails/activerecord/lib/active_record/associations.rb:661:in
`task'
./script/../config/../vendor/rails/activerecord/lib/active_record/associations.rb:654:in
`task'
#{RAILS_ROOT}/app/controllers/account_controller.rb:96:in
`redirect_to_last_viewed_task'
#{RAILS_ROOT}/app/controllers/account_controller.rb:80:in `login'

and simultaneously in the log I get:
WARNING: Deprecated reference to top-level constant 'Task'found at:
/opt/local/lib/ruby/gems/1.8/gems/rake-0.7.0/lib/rake.rb:1702:in
`rakefile_location'
    Use --classic-namespace on rake command
    or 'require "rake/classic_namespace"' in Rakefile

I've even tried specifying
belongs_to :task, :class_name => "ActiveRecord::Task", :foreign_key =>
'task_id'
and still no luck.  Any suggestions?

I'm on Edge Rails.

Thanks!
Jason
This topic is locked and can not be replied to.