Has Messages plugin
Plugin details
Documentation
ruby script/plugin install http://svn.pluginaweek.org/trunk/has_messages
Description
===========
Messaging between users and other parts of a system is a fairly common feature in web applications, especially for those that support social networking. Messaging doesn't necessarily need to be between users, but can also act as a way for the web application to send notices and other notifications to users.
Designing and building a framework that supports these messaging capabilities can become complex and cumbersome and takes away from the focus of the web application. This plugin helps ease that process by providing a complete implementation for sending and receiving messages to and between models in your application.
Usage
========
Adding message support
--------------------------------
class User < ActiveRecord::Base has_messages end
Creating new messages
----------------------------
message = user.messages.build message.to << [user1, user2] message.subject = 'Hey!' message.body = 'Does anyone want to go out tonight?' message.deliver!
Replying to messages
-------------------------------
reply = message.reply_to_all reply.body = "I'd love to go out!" reply.deliver!
Forwarding messages
----------------------------
forward = message.forward forward.body = 'Interested?' forward.deliver!
External process messaging
-------------------------------------
In addition to delivering messages immediately, you can also *queue* messages so that an external application processes and delivers them. This is especially useful for messages that need to be sent outside of the confines of the web pplication, such as emails (see has_emails[http://wiki.pluginaweek.org/Has_emails]).
To queue messages for external processing, you can simply use the queue! event, rather than deliver!. This will indicate to any external processes that the message is ready to be sent. The external process can then invoke deliver! whenever it is ready to send the queued message.
Further Documentation
There is currently no advanced documentation for this plugin.
New documentationEdit plugin | Back in time (1 older version) | Last edited by: obrie572, about 1 month ago

