我正在生成一个包含 Message 属性的哈希“消息”,如下所示:
message = Message.create_from_mail_message(mail, @current_sender_email, expires_at, public, message_type)
现在我想为这个哈希“消息”添加一个附加属性“access_key”,问题是这个属性不在消息模型中,而是在收据中。关于如何做到这一点的任何想法。
现在消息哈希返回我这个:
{"active":1,"body":"","created_at":"2013-10-30T10:49:41Z","creator_id":6,"expires_at":"2013-11-29T10:49:41Z","id":25,"message_type_id":1,"public":0,"reply_to":null,"slug":"fa2fd66f-7e32-4e3f-898b-8412c676a0ff","subject":"2af03892533ffb43\ufffdh\ufffdf\ufffdS+9<\b&\u0017\ufffd\u0016/\ufffd","updated_at":"2013-10-30T10:49:41Z"}
“access_key”可以通过以下方式检索:
access_key = Reciept.access_key
提前致谢。