class Ladder < ActiveRecord::Base has_many :players has_many :users, :through => :players end
class Player < ActiveRecord::Base belongs_to :users belongs_to :ladders end
class User < ActiveRecord::Base has_many :players has_many :ladders, :through => :players end
When I try the following code (on the console) I get an error:
@ladder = Ladder.find(1) @ladder.users
I get this error:
NameError: uninitialized constant Ladder::Users from /opt/local/lib/ruby/gems/1.8/gems/activesupport-1.4.2/lib/ active_support/dependencies.rb:477:in `const_missing' from /opt/local/lib/ruby/gems/1.8/gems/activerecord-1.15.3/lib/ active_record/base.rb:1360:in `compute_type' from /opt/local/lib/ruby/gems/1.8/gems/activerecord-1.15.3/lib/ active_record/reflection.rb:125:in `send' from /opt/local/lib/ruby/gems/1.8/gems/activerecord-1.15.3/lib/ active_record/reflection.rb:125:in `klass' from /opt/local/lib/ruby/gems/1.8/gems/activerecord-1.15.3/lib/ active_record/associations/has_many_through_association.rb:115:in `find_target' from /opt/local/lib/ruby/gems/1.8/gems/activerecord-1.15.3/lib/ active_record/associations/association_proxy.rb:131:in `load_target' from /opt/local/lib/ruby/gems/1.8/gems/activerecord-1.15.3/lib/ active_record/associations/association_proxy.rb:122:in `method_missing' from /opt/local/lib/ruby/gems/1.8/gems/activerecord-1.15.3/lib/ active_record/associations/has_many_through_association.rb:108:in `method_missing' from /opt/local/lib/ruby/1.8/irb.rb:298:in `output_value' from /opt/local/lib/ruby/1.8/irb.rb:151:in `eval_input' from /opt/local/lib/ruby/1.8/irb.rb:259:in `signal_status' from /opt/local/lib/ruby/1.8/irb.rb:147:in `eval_input' from /opt/local/lib/ruby/1.8/irb.rb:146:in `eval_input' from /opt/local/lib/ruby/1.8/irb.rb:70:in `start' from /opt/local/lib/ruby/1.8/irb.rb:69:in `catch' from /opt/local/lib/ruby/1.8/irb.rb:69:in `start' from /opt/local/bin/irb:13
What am I missing with the :through parameter? It's driving me nuts.
-S