Hi Walter,

First, thank you for your reply and for your explanation of what UID 
means. In my app I have the following table for private messages:

create_table "private_messages", force: true do |t|
    t.integer  "sender_uid"
    t.integer  "receiver_uid"
    t.text     "subject"
    t.text     "body"
    t.datetime "created_at"
    t.datetime "updated_at"
  end

However, when I enter, PrivateMessages, in rails console, I get a syntax 
error: syntax error, unexpected tSTRING_BEG, expecting =>
  belongs_to :sender, foreign_key: 'sender_uid', :class_name 'User'

The same error appears for receiver_uid...

Per your explanation, does this mean that I have to add a columns, 
sender and receiver, to my users table? Or, should I make a 
sent_messages table and a received_messages table, giving them a foreign 
key, user_id?

Or in my User model, should I create the following associations:
        has_many :sent_messages, class_name: 'PrivateMessages', 
foreign_key: 'sender_uid'
   has_many :received_messages, class_name: 'PrivateMessages', 
foreign_key: 'receiver_uid'

I really appreciate your feedback, Walter.

---------

Allow me to add a little context here, seeing as that I did not in my 
original post -- I have built a basic application, and I have built 
other applications (A pinterest app, a Reddit app, A black jack app) via 
available tutorials etc..., although I have not built the Hartl's 
tutorial. Moreover, I have some experience with Ruby and OOP -- granted, 
not enough. I'm still fairly junior and would not try to sell myself 
otherwise. Rails is just Ruby, and I am aware of that so I prefer 
focusing on my Ruby competency, seeing as that makes rails development 
more intelligent.

My application is a bootstrapping platform for nonprofits. One of its 
main functionalities will allow nonprofits to work with volunteers on 
particular projects. However, before I go further in detail, the glue to 
all of these functionalities requires a, notification system that 
contains messages, project updates, forum updates etc...

I want to help charities. Your advice and anyone else's is greatly 
appreciated -- this is not a for profit venture...just trying to add a 
little more good into the world :-)

-- 
Posted via http://www.ruby-forum.com/.

-- 
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to rubyonrails-talk+unsubscr...@googlegroups.com.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/rubyonrails-talk/47064f0a45aa2022ab1788ff2cc4d1b3%40ruby-forum.com.
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to