search for: report_field_a

Displaying 1 result from an estimated 1 matches for "report_field_a".

Did you mean: report_field_b
2011 Feb 03
0
Correct way to exclude attributes from json serialization
...report = Report.where(:report_id => params[:id]).first respond_with report end end This works ok, but pushes out every attribute on the document including the "internal" mongodb document id, e.g. : { _id: 54857324987546, // internal mongoid document id report_field_a: 1, report_field_b: 2, etc } I would like to strip this when serializing the report to json, and I would also like any embedded documents to have their _id properties excluded too. I have searched for info on as_json, to_json etc but I''m not sure which is the best practice approac...