title: Add new attribute to existing hash
body: <p>I am retrieving results using Mongoid, but I want to add a new attribute to each of the records returned in an instance variable using the key. How would I go about doing this?</p>
  
  <p>In PHP I would do this by looping through the array and inserting it based on the key of the object. I am unable to figure out how this can be done in Ruby when I receive the message: Model ABC can't be converted into an Integer.</p>
  
  <p><strong>Update:</strong> I ended up adding a method in the model to achieve what I was trying to do.</p>