mailboxer mailboxer_receipts table

23 views
Skip to first unread message

fugee ohu

unread,
Sep 21, 2017, 9:29:23 PM9/21/17
to Ruby on Rails: Talk
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?

Colin Law

unread,
Sep 22, 2017, 2:21:51 AM9/22/17
to Ruby on Rails: Talk
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.

fugee ohu

unread,
Sep 22, 2017, 10:03:14 AM9/22/17
to Ruby on Rails: Talk


On Friday, September 22, 2017 at 2:21:51 AM UTC-4, Colin Law wrote:
On 22 September 2017 at 02:29, fugee ohu <fuge...@gmail.com> wrote:
> 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.


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

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

fugee ohu

unread,
Sep 22, 2017, 10:32:46 AM9/22/17
to Ruby on Rails: Talk


On Friday, September 22, 2017 at 2:21:51 AM UTC-4, Colin Law wrote:
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')
 

fugee ohu

unread,
Sep 22, 2017, 11:07:13 AM9/22/17
to Ruby on Rails: Talk


On Friday, September 22, 2017 at 2:21:51 AM UTC-4, Colin Law wrote:
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

Colin Law

unread,
Sep 22, 2017, 12:17:35 PM9/22/17
to Ruby on Rails: Talk
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

>
> --
> 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/744df08f-b999-4b80-a480-d721e41fa4a8%40googlegroups.com.

fugee ohu

unread,
Sep 22, 2017, 3:07:58 PM9/22/17
to Ruby on Rails: Talk
What I said is true
Message has been deleted

fugee ohu

unread,
Sep 22, 2017, 4:58:44 PM9/22/17
to Ruby on Rails: Talk
 
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

Colin Law

unread,
Sep 22, 2017, 5:04:51 PM9/22/17
to Ruby on Rails: Talk
On 22 September 2017 at 21:58, fugee ohu <fuge...@gmail.com> wrote:
> ..
> 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

fugee ohu

unread,
Sep 22, 2017, 5:32:33 PM9/22/17
to Ruby on Rails: Talk
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

fugee ohu

unread,
Sep 22, 2017, 5:33:21 PM9/22/17
to Ruby on Rails: Talk
The readme.md doesn't say you have to use the models does it?

fugee ohu

unread,
Sep 22, 2017, 6:06:02 PM9/22/17
to Ruby on Rails: Talk
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

Colin Law

unread,
Sep 23, 2017, 10:13:47 AM9/23/17
to Ruby on Rails: Talk
On 22 September 2017 at 22:32, fugee ohu <fuge...@gmail.com> wrote:
>
>
> On Friday, September 22, 2017 at 5:04:51 PM UTC-4, Colin Law wrote:
>>
>> On 22 September 2017 at 21:58, fugee ohu <fuge...@gmail.com> wrote:
>> > ..
>> > 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
Reply all
Reply to author
Forward
0 new messages