I have an app using Mongoid on top of MongoDB and an update is failing silently.
The code looks like this:
# Are we getting a new attribute? Yes we are!
p "attr first name = #{@attributes['first_name']}"
if user.update_attributes!(@attributes)
u = User.find(params[:id]).to_json
end
No exception is thrown in this code. So I looked at my MongoDB log and constructed this query based on what mongo is trying to do:
db.users.update({ "_id": "4d5561276ce886c496000001" }, { $set: { "first_name": "Erinamodobo" } }, false);
Now this does not cause any exceptions but when I grab the record that was supposed to be updated with this query:
db.users.find({"email":"escharling@somecompany.com"})
I see that the “first_name” attribute has not been updated.
Any idea why this could be happening? Sounds like something stupid.
Thanks!
Updating Mongoid to the latest rc.7 fixed this issue