search for: sent_messag

Displaying 4 results from an estimated 4 matches for "sent_messag".

Did you mean: send_message
2005 Dec 19
4
need some help designing my messaging system
I am trying to create a messaging system for my users but I''m having a hard time designing my db. This is what i have in mind, but I am not sure if its the best approach. user has_one inbox user has_one outbox inbox has_many messages outbox has_many messages inbox table user_id outbox table user_id messages table box_id (refers to either inbox or outbox - how?) from_id to_id
2011 Jun 23
2
RSpec book help; why won't this stub method work?
Subscription model-------------------------------------------- class Subscription < ActiveRecord::Base has_one :user def can_send_message? if user.sent_messages.count < limit true else false end end end Subscription model spec-------------------------------------------- require ''spec_helper'' describe Subscription do describe "#can_send_message?" do before(:each) do @subscription = Subs...
2012 Feb 14
2
Model with 2 foreign keys
...:to_user_id (for the user that sent and the user that recieved the message). Obivously, (User) has_many :messages will fetch the messages that a certain user has created, but not the ones that they have been sent. Currently, I have this: has_many :messages, :foreign_key=>:to_user_id has_many :sent_messages, :class_name=>''Message'', :foreign_key=>:from_user_id So I have to get all the messages with 2 separate calls(and sets of queries). This doesn''t seem quite right to me, and was wondering if there is a better way. Is it possible to retrieve all messages for a user...
2008 Apr 08
1
Problem with has_many
Hi all I''ve got a message table, where the sender and the receiver are stored (sender_user_id, receiver_user_id) How must i declare this dependencies in the user and message model? I''ve got the following one: has_many :messages, :foreign_key=> ''receiver_user_id'' but how to declare the secound one? Thank you for your help! Greets --