加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 百科 > 正文

ruby-on-rails – Rails 3序列化问题

发布时间:2020-12-17 03:12:18 所属栏目:百科 来源:网络整理
导读:我有一个适用于ror 2.3.x的应用程序.我无法使用序列化升级到Rails 3. 代码看起来像这样 class PaymentTransaction ActiveRecord::Base serialize :responseend 响应应该包含ActiveMerchant :: Billing :: Response.由于某种原因,使用rails 3将其保存为字符串
我有一个适用于ror 2.3.x的应用程序.我无法使用序列化升级到Rails 3.

代码看起来像这样

class PaymentTransaction < ActiveRecord::Base
  serialize :response
end

响应应该包含ActiveMerchant :: Billing :: Response.由于某种原因,使用rails 3将其保存为字符串.

=> #<PaymentTransaction id: 11,order_id: nil,amount: nil,mode: nil,payment_profile_id: nil,response: "#<ActiveMerchant::Billing::Response:0x1051aec98>",created_at: "2010-11-07 04:06:03",updated_at: "2010-11-07 04:24:58",result: "pending",payee: nil,login_id: nil,transaction_key: nil>

关于升级的任何其他博客我没有关于序列化的任何注释.有什么想法吗?

解决方法

轨道3的变化很小,有效: https://github.com/rails/rails/commit/c1d73270717f30498f8f4d55d6695509107c2834

这里有两篇关于序列化的好文章:

> http://www.simonecarletti.com/blog/2010/04/inside-ruby-on-rails-serializing-ruby-objects-with-json/
> http://www.skorks.com/2010/04/serializing-and-deserializing-objects-with-ruby/

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读