title: How to get the parent objects class name from an attribute
body: <p>Is it possible to return the parent object of a given attribute?</p>
  <h1>Example</h1>
  <pre><code>  a = User.birthdate
    a.parent_object ... should return the user record that is the parent of the birthdate attribute
  </code></pre>
  <p>A better example?</p>
  <h1>Helper</h1>
  <pre><code> def item_grade(subject, obj)
       obj.scale.grades.find(subject.grade_id).name # would return something like &quot;Pass&quot;, &quot;Fail&quot;, &quot;Good Job&quot;
   end
  </code></pre>
  <h1>In the view</h1>
  <pre><code> item_grade(@course.subject, @course)
  </code></pre>
  <p>This approach requires two options to be passed to the helper.  It seems I should be able to pass @course.subject and then get the parent object from that</p>
  <h1>Helper</h1>
  <pre><code> def item_grade(subject)
       a = subject.parent_object.scale
       a.grades.find(subject.grade_id).name
   end
  </code></pre>
  <h1>View</h1>
  <pre><code> item_grade(@course.subject)
  </code></pre>