title: Parent model method is undefined
body: <p>I'm an absolute beginner to Ruby on Rails; I literally started last night.  I'm following the <a href="http://guides.rubyonrails.org/getting_started.html" rel="nofollow">Getting Started with Rails</a> tutorial, although I've made a few modifications.  Instead of a blog with posts and comments, I'm making a simple task-tracking application in which Projects have Tasks associated with them.</p>
  
  <p>Everything was going quite well until <a href="http://guides.rubyonrails.org/getting_started.html#deleting-comments" rel="nofollow">step #9 (Deleting Comments)</a>.  According to the tutorial, I should be able to get the parent model for a comment by calling <code>comment.post</code>, the analogue of which in my case is <code>task.project</code>.  But when Rails tries to render the partial in which I've got <code>task.project</code>, it raises a NoMethodError:</p>
  
  <pre><code>undefined method `project' for #&lt;Task:0x7fb0011cf058&gt;
  </code></pre>
  
  <p>My models are as follows:</p>
  
  <pre><code>class Project &lt; ActiveRecord::Base
    validates :name, :presence =&gt; true
  
    has_many :tasks, :dependent =&gt; :destroy
  end
  
  class Task &lt; ActiveRecord::Base
    validates :name, :presence =&gt; :true
  
    belongs_to :project
  end
  </code></pre>
  
  <p>Using the rails console, I determined that my tasks do have a <code>project_id</code> method which returns the ID of the associated project.  Thus, I can get around the problem by using <code>Project.find(task.project_id)</code> instead of <code>task.project</code> in my partial.  That seems "wrong," though, and makes me wonder if the relationship between my two models is somehow broken.</p>
  
  <p>What's going on here?</p>
  
  <p><strong>Update:</strong> If I comment out the <code>validates</code> line in the Task model, then all of its methods work properly.  I don't understand why that is the case, though.</p>
  
  <p><strong>Update 2:</strong> Figured it out.  I was using the symbol <code>:true</code> instead of the simple boolean value in the <code>validates</code> line of my Task model.  Had I paid more attention to the stack trace in the first place, I would have figured it out much sooner.  What an embarrassing mistake!</p>