Question: 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.

Answer: 
You should merge the access\_key with value in message hash like:

message.merge!("access\_key" => Reciept.access\_key)
Try this:

```
message.merge!('access_key' => Reciept.access_key)

```