Hey peeps,
I have the following models:
class Profile < ActiveRecord::Base
has_many :tracks, :through => :watcher
has_many :watchers
end
class Watcher < ActiveRecord::Base
belongs_to :profile
belongs_to :watchable, :polymorphic => true
end
class Track < ActiveRecord::Base
has_many :watchers, :as => :watchable, :dependent => :destroy
has_many :profiles, :through => :watchers
end
To explain things a bit more, a Profile can upload a Track. Other
Profiles can Watch this Track for new Comments. This all is working
fine, except for when I try to do something with a track in my Profile
model.
For instance (a track actually belongs to a user, which has a profile):
def test
tracks.each do |t|
t.user.profile
end
end
Then I get the error: Could not find the association :watcher in model
Track
Anybody any idea what might be wrong? I''d be more than happy to share
more code.
--
Posted via http://www.ruby-forum.com/.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Ruby on Rails: Talk" group.
To post to this group, send email to
rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk
-~----------~----~----~----~------~----~------~--~---