improving to_json to optionally include many_to_many relationships