【发布时间】:2010-10-15 13:18:02
【问题描述】:
我的 json 序列化工作正常
render :json => "#{current_object.serialize(:json, :attributes => [:id, :name])}
但我还想在它被设置回客户端之前向 json 添加更多数据。主要是auth_token。
疯狂地用谷歌搜索,但我找不到序列化将采取什么选项来允许我将其他数据附加/合并到 JSON 中。
希望找到类似的东西......
current_object.serialize(:json, :attriubtes => [:id, name], :magic_option => {:form_authenticity_token => "#{form_authenticity_token}"})
【问题讨论】:
标签: ruby-on-rails ruby json serialization activerecord