I am working on implementation of the Mailboxer gem, but I am having issues with displaying messages. Here's the action where I save sent messages:
#MessagesController
def create
# current_user - ID: 253
# @user - ID: 1
@user = User.find(params[:user_id])
send_message = current_user.send_message(@user, params[:message][:body], params[:message][:subject]).conversation
puts send_message.inspect
redirect_to messages_url
end
The output of send_message is
#<Receipt id: nil, receiver_id: 253, receiver_type: "User", notification_id: nil, is_read: true, trashed: false, deleted: false, mailbox_type: "sentbox", created_at: nil, updated_at: nil>
Shouldn't be the receiver_id #1? Also, where are these data stored, in which table?
When I display sent messages (current_user.mailbox.sentbox), I don't see there this message that I just sent out. And when I log in as the user with ID 1, I don't see there the received message neither.
What am I doing wrong?
Thank you