mailboxer mailboxer_receipts table

When I send messages I see in the log that inserts made to mailboxer_receipts table for field receiver_id have the id of the sender rather than the recipient What table is supposed to hold the id of the recipient? Is it mailboxer_receipts?

When I send messages I see in the log that inserts made to
mailboxer_receipts table for field receiver_id have the id of the sender
rather than the recipient What table is supposed to hold the id of the
recipient? Is it mailboxer_receipts?

That depends on what relationships you have setup between the models.

Colin

In all cases mailboxer sets up those 4 tables Which of them is supposed to hold the reciepient type and id?

Inserts are made to 3 tables There’s no messages and conversations tables or models

Processing by MessagesController#create as HTML
Parameters: {“utf8”=>“���”, “authenticity_token”=>“67ksqg0yswrb3ofmlxaBLsVfRibQg/b+M2idue237qT5sn3b3mylzmcZK4O0GSQHcgoFxD6mu4JL0ZR5dkVAow==”, “message”=>{“subject”=>“test”, “body”=>“test”, “recipients”=>“5”}, “commit”=>“Send”}
User Load (1.2ms) SELECT users.* FROM users WHERE users.id = 1 ORDER BY users.id ASC LIMIT 1
(0.3ms) BEGIN
SQL (0.6ms) INSERT INTO mailboxer_conversations (subject, created_at, updated_at) VALUES (‘test’, ‘2017-09-22 14:27:05’, ‘2017-09-22 14:27:05’)
SQL (1.8ms) INSERT INTO mailboxer_notifications (type, body, subject, sender_type, sender_id, conversation_id, updated_at, created_at) VALUES (‘Mailboxer::Message’, ‘test’, ‘test’, ‘User’, 1, 24, ‘2017-09-22 14:27:05’, ‘2017-09-22 14:27:05’)
SQL (0.6ms) INSERT INTO mailboxer_receipts (receiver_type, receiver_id, notification_id, is_read, mailbox_type, created_at, updated_at) VALUES (‘User’, 1, 25, 1, ‘sentbox’, ‘2017-09-22 14:27:05’, ‘2017-09-22 14:27:05’)

mailboxer setup install followed by migrate doesn’t create any models, just those 4 tables, so it would seem the models aren’t necessarily needed

> When I send messages I see in the log that inserts made to
> mailboxer_receipts table for field receiver_id have the id of the sender
> rather than the recipient What table is supposed to hold the id of the
> recipient? Is it mailboxer_receipts?

That depends on what relationships you have setup between the models.

Colin

>
> --
> You received this message because you are subscribed to the Google
> Groups
> "Ruby on Rails: Talk" group.
> To unsubscribe from this group and stop receiving emails from it, send
> an
> email to rubyonrails-ta...@googlegroups.com.
> To post to this group, send email to rubyonra...@googlegroups.com.
> To view this discussion on the web visit
>
> https://groups.google.com/d/msgid/rubyonrails-talk/81957f23-6a9a-4fe8-8bce-4e186937c62a%40googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.

mailboxer setup install followed by migrate doesn't create any models, just
those 4 tables, so it would seem the models aren't necessarily needed

Migrations never create models, they just setup the database. The
models are defined in the gem code.
https://github.com/mailboxer/mailboxer/tree/master/app/models/mailboxer

I suggest you take a day or three out and work right through the
tutorial at railstutorial.org, which is free to use online, that will
show you the basics of rails.

Colin

What I said is true

So
what type of relationships were you imagining I’ve set up My user model acts_as_messageable that’s all What are you talking about

You said that models were not needed for the tables, if you look at
the link I posted you will be able to see the models and the
relationships between the them.

Colin

Those models have no corresponding tables but i see conversations have many messages and receipts and notifications and those models in turn belong to conversations That’s nice but it doesn’t help me figure out why when i send a message to a single recipient where in the tables should I expect to find the recipients id then I can try to figure out what happens to messages sent that don’t show in the receiving users inbox Thanks

The readme.md doesn’t say you have to use the models does it?

Setup without the models and helpers, sent messages don’t appear in the recipient users’s inbox but they do appear in the sending users sent box After inadding the models and helpers the behavior didn’t change Trying to figure out why messages sent don’t appear in the recipients inbox ~ thanks

> ..
> So what type of relationships were you imagining I've set up My user
> model
> acts_as_messageable that's all What are you talking about

You said that models were not needed for the tables, if you look at
the link I posted you will be able to see the models and the
relationships between the them.

Colin

Those models have no corresponding tables

In that case it is odd that, for example, receipt.rb contains the line
self.table_name = :mailboxer_receipts
which rather suggests there is a corresponding table.

Colin