SyntaxFix
Write A Post
Hire A Developer
Questions
you can do
hash.inject({}){|option, (k,v) | option["id"] = v if k == "_id"; option}
This should work for your case!