title: Inbox messages in rails like facebook
body: <p>I am trying to create a personal inbox message system but couple question are on my mind. First let me explain my system.</p>
  
  <p>Here is my table model</p>
  
  <pre><code>  create_table "inboxmessages", :force =&gt; true do |t|
      t.integer  "receiver_id"
      t.integer  "sender_id"
      t.integer  "message_id"
      t.boolean  "isread"
      t.boolean  "isstarred"
      t.datetime "created_at",  :null =&gt; false
      t.datetime "updated_at",  :null =&gt; false
    end
  
    create_table "messages", :force =&gt; true do |t|
      t.string   "subject"
      t.text     "body"
      t.datetime "created_at", :null =&gt; false
      t.datetime "updated_at", :null =&gt; false
    end
  </code></pre>
  
  <p>The relationship would be has follow</p>
  
  <pre><code>inboxmessages
    belongs_to :message
    belongs_to :user, :class_name =&gt; "User", :foreign_key =&gt; "sender_id"
    belongs_to :user, :class_name =&gt; "User", :foreign_key =&gt; "receiver_id"
  messages
    has_many :inboxmessages
  user
    has_many :inboxmessages
  </code></pre>
  
  <p>The problem that i am having his i am uncertain on how to create a message which allows me multiple users. here the schema of the form i am trying to have</p>
  
  <pre><code>Message.subject
  Inboxmessage.receiver # but have multiple different user
  ------------------------------------------------------------------------
  Message.body
  Inboxmessage.sender = current_user # hidden field
  </code></pre>
  
  <p>Here are the question that I have regarding building this model/controller/app</p>
  
  <pre><code>1 - Should my new form be in inboxmessages or messages?
  2 - Should I use accept_nested_for or should I use nested resources
  3 - Is my model/database is okay or not the best?
  4 - Are my foreign_key relationship well define?
  </code></pre>
  
  <p>Thanks in advance!!</p>