title: Custom method in model to return an object
body: <p>In the database I have a field named 'body' that has an XML in it. The 
  method I created in the model looks like this:</p>
  
  <pre><code>def self.get_personal_data_module(person_id) 
      person_module = find_by_person_id(person_id) 
      item_module = Hpricot(person_module.body) 
      personal_info = Array.new 
      personal_info = {:studies =&gt; (item_module/"studies").inner_html, 
                              :birth_place =&gt; (item_module/"birth_place").inner_html, 
                              :marrital_status =&gt; (item_module/"marrital_status").inner_html} 
      return personal_info 
  end 
  </code></pre>
  
  <p>I want the function to return an object instead of an array. So I can 
  use Module.studies instead of Model[:studies].</p>