这是我想要做的事情:
new_set = set.map do |d|
{ id: d.id, first_name: d.firstname, last_name: d.lastname, full_name: d.full_name, score: d.score, photo: d.user.avatar(:medium), sex: d.sex, bio: d.bio, google_plus: d.google_plus, facebook: d.facebook, protocol: d.protocol, verified: d.verified, excellence: d.excellence, verified_at: d.verified_at, excellence_at: d.excellence_at, protocol_at: d.protocol_at, educations: d.educations, qualifications: d.qualifications, services: d.services, branches: d.branches, reviews: d.dispenser_reviews.where(:approved=>true) }
end
现在,当我尝试new_set.to_json
时,我会获得逃避报价。
当我跑new_set.as_json
时,我会得到哈希火箭。
有没有办法获得有效的JSON,包括上面new_set
中的信息?