Can anyone see why the league_organizers relation is failing.

class League < ActiveRecord::Base
  has_many :league_admins
  has_many :league_organizers, :through => :league_admins, :class_name
=> "User"

class LeagueAdmin < ActiveRecord::Base
  belongs_to :league
  belongs_to :user

I am getting the following error message:

ActiveRecord::HasManyThroughSourceAssociationNotFoundError: Could not
find the source association(s) :league_admins in model LeagueAdmin.  Try
'has_many :league_organizers, :through => :league_admins, :source =>
<name>'.  Is it one of :league or :user?
  from
/Library/Ruby/Gems/1.8/gems/activerecord-2.1.0/lib/active_record/reflection.rb:199:in
`check_validity!'
  from
/Library/Ruby/Gems/1.8/gems/activerecord-2.1.0/lib/active_record/associations/has_many_through_association.rb:5:in
`initialize'
  from
/Library/Ruby/Gems/1.8/gems/activerecord-2.1.0/lib/active_record/associations.rb:1128:in
`new'
  from
/Library/Ruby/Gems/1.8/gems/activerecord-2.1.0/lib/active_record/associations.rb:1128:in
`league_organizers'
  from (irb):2


I tried adding the source option with and without the class_name but it
still fails.  As I mentioned it is a simple relation.  Has something
changed in the last while to cause this?

I am currently using Rails 2.2.2

Thanks for the help.
-- 
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@googlegroups.com
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to