Reputation: 21
I am producing a hash "message" containing Message attributes like this:
message = Message.create_from_mail_message(mail, @current_sender_email, expires_at, public, message_type)
Now I want to add an additional attribute "access_key" to this hash "message" problem is this attribute is not in Message model but in Receipt. Any idea about how to do this.
Right now message hash returns me this :
{"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" can be retrieve by:
access_key = Reciept.access_key
Thanks in advance.
Upvotes: 2
Views: 8455
Reputation: 2404
the Standar say:
message.merge(:access_key=>Reciept.access_key)
I hope can i help you.
Upvotes: 0
Reputation: 1040
You should merge the access_key with value in message hash like:
message.merge!("access_key" => Reciept.access_key)
Upvotes: 6