title: Rails, has_many :through, undefined method `to_sym` for nil:NilClass
body: <p>I have been learning rails and i have stumbled one problem with relationships. I have many-to-many association User - Tournament, and for some reason i can't access participated_tournaments on User instances, or can't access participants on Tournament instances.</p>
  
  <pre><code>2.0.0-p643 :001 &gt; Tournament.new.participants
  NoMethodError: undefined method `to_sym' for nil:NilClass
  from /home/marcin/.rvm/gems/ruby-2.0.0-p643/gems/activerecord-4.1.8/lib/active_record/reflection.rb:100:in `_reflect_on_association'
  from /home/marcin/.rvm/gems/ruby-2.0.0-p643/gems/activerecord-4.1.8/lib/active_record/reflection.rb:537:in `source_reflection'
  </code></pre>
  
  <p>User model</p>
  
  <pre><code>class User &lt; ActiveRecord::Base
    has_many :participants_tournaments
    has_many :participated_tournaments, :through =&gt; :participants_tournaments
  end
  </code></pre>
  
  <p>Tournament model</p>
  
  <pre><code>class Tournament &lt; ActiveRecord::Base
    has_many :participants_tournaments
    has_many :participants, :through =&gt; :participants_tournaments
  end
  </code></pre>
  
  <p>ParticipantsTournament model</p>
  
  <pre><code>class ParticipantsTournament &lt; ActiveRecord::Base
    belongs_to :tournament
    belongs_to :user
  end
  </code></pre>
  
  <p>ParticipantsTournament migration</p>
  
  <pre><code>def change
    create_table :participants_tournaments, :id =&gt; false do |t|
      t.integer "tournament_id",
      t.integer "user_id"
    end
  end
  </code></pre>
  
  <p>I have read:
  <a href="https://stackoverflow.com/questions/27030407/many-to-many-relationship-only-works-one-way-rails-activerecord-devise">This topic on SO</a>, <a href="https://stackoverflow.com/questions/5403819/has-many-through-association">also this topic</a> and watched/read <a href="http://railscasts.com/episodes/47-two-many-to-many" rel="nofollow noreferrer">this railscast</a>, but i can't seem to finally get it working.</p>