Reputation: 20445
I am working on a simple intra-site private messaging system, which looks similar to Facebook messages. I would like to have an email marked as read if user click on a button that leads to mailbox page, which shows multiple emails .
I am undecided about where to put this logic: in controller under messages_controller#show or in model using after_touch callback.
My question is: which solution is better and why?
Upvotes: 1
Views: 242
Reputation: 1165
It sounds like you want to control when it gets marked as read, so I'd suggest doing it in messages_controller#show
This would simplify things such as having another interface for viewing messages (sent items?) that didn't mark them as read.
Upvotes: 2