Messaging system using Rails

A Message should have 1 sender and 1…n receivers

class Message < ActiveRecord:Base has_one sender, :class_name => :user #or whatever has_and_belongs_to_many :receivers, :class_name => :user end

like this it can be modelled (dunno if thats completely correct code)

thats exactly right, altough you could use a join model, too (via has_many :through) to be able to mark the message as read or deleted via the join (among other stuff).

Another option might be to use a decorated join model. soething like,

has_many :messages, :through => :communications

communications could have fields for message_id, recipient_id, sender_id, date_sent, etc also you could have a field type to store single table inheritance information to know if a message is a post, comment or reply.

The possibilities are endless. Good luck.