title: Can't write unknown attribute `challenge_id'
body: <p>My code is like this:</p>
  
  <p>routes.rb</p>
  
  <pre><code>resources :challenges  do
     resources :problems
  end
  </code></pre>
  
  <p>app/models/challenge.rb</p>
  
  <pre><code>class Challenge &lt; ActiveRecord::Base
    has_many :problems
  end
  </code></pre>
  
  <p>app/models/problem.rb</p>
  
  <pre><code>class Problem &lt; ActiveRecord::Base
    belongs_to :challenge
  end
  </code></pre>
  
  <p>db/migrate/createchallenges.db</p>
  
  <pre><code>class CreateChallenges &lt; ActiveRecord::Migration
    def change
      create_table :challenges do |t|
        t.string :name
        t.timestamps
      end
    end
  end
  </code></pre>
  
  <p>db/migrate/createproblems.rb</p>
  
  <pre><code>class CreateProblems &lt; ActiveRecord::Migration
    def change
      create_table :problems do |t|
        t.belongs_to :challenge
        t.string :description
        t.timestamps
      end
    end
  </code></pre>
  
  <p>end</p>
  
  <p>app/controllers/problem_controller.rb</p>
  
  <pre><code>class ProblemsController &lt; ApplicationController
    def new
          @challenge = Challenge.find(params[:challenge_id])
          @problem = Problem.new(:challenge =&gt; @challenge)
    end
  end
  </code></pre>
  
  <p>I can create a "challenge" with no problems, but when I create a new "problem", I got the error:</p>
  
  <pre><code>can't write unknown attribute `challenge_id'
  </code></pre>
  
  <p>At the line</p>
  
  <pre><code>@problem = Problem.new(:challenge =&gt; @challenge)
  </code></pre>
  
  <p>What may be causing this error?</p>