We implemented a simple chat feature in Rails using simple Ajax updates. Now in each chat room a message belongs to a specific user. We want to show a list of users (something like user presence). Please suggest ways. We do not use Jabber, XMPP, etc.
Chatroom Model:
class ChatRoom < ActiveRecord::Base validates_presence_of :title has_many :messages,:foreign_key=> "chat_room_id" has_many :stories,:foreign_key=>"chat_room_id" has_many :topics,:foreign_key=>"chat_room_id" end
Messages are chats sent to each user.
Message Model:
class Message < ActiveRecord::Base belongs_to :user end
User Model:
class User < ActiveRecord::Base acts_as_authentic :crypto_provider => Authlogic::CryptoProviders::BCrypt validates_presence_of :nick validates_uniqueness_of :nick has_many :questions end
Please suggest ways
source share