GUI Example on a real application
Clone this wiki locally
What mailboxer adds to you is a core for sending messages. Just by adding "acts_as_messageable" to your User (or Whatever) model you get a lot of new methods added to it. For a full API you should refer to rubydoc. This core includes several models: Message, Conversation (a wrapper of messages), Receipt (relation model between the messageable and the message), Notification (related to notification system, not messaging system), Mailbox (managing the conversations, messages and receipt of a messageable) and Messageable (modeling the new methods added to your model "acting as messageable".
Mailboxer was created as a part of SocialStream, a core to build social networks. As mailboxer is already integrated there, is a good start point to you. If you have serious problems understanding what goes now, please consider following some tutorials regarding rails 3.1, gems and engines, which will surely be helpful.
The best way to do it ruby-like and restful is to create two controllers:
To add your routes in config/routes.rb (example):
Rails.application.routes.draw do #... resources :messages resources :conversations #... end
ConversationsControllers should look like this.
MessagesControllers should look like this.
Please, notice that there are parts of the code not related with mailboxer, as the line
related to the authentication protocol of SocialStream.
assets and in
vendor) that you should look if you want to copy it exactly this way (which I really don't recommend). The best way is to understand the views and make them your own way.