Method: Mailboxer::Models::Messageable#trash
- Defined in:
- lib/mailboxer/models/messageable.rb
#trash(obj) ⇒ Object
Mark the object as trashed for messageable.
Object can be:
-
A Receipt
-
A Message
-
A Notification
-
A Conversation
-
An array with any of them
193 194 195 196 197 198 199 200 201 202 203 204 |
# File 'lib/mailboxer/models/messageable.rb', line 193 def trash(obj) case obj when Mailboxer::Receipt obj.move_to_trash if obj.receiver == self when Mailboxer::Message, Mailboxer::Notification obj.move_to_trash(self) when Mailboxer::Conversation obj.move_to_trash(self) when Array obj.map{ |sub_obj| trash(sub_obj) } end end |