title: Rails ArgumentError "Unknown Key"?
body: <p>So I have a Rails app in which users can create 'submissions'. Now I'm trying to add the ability to create folders in which submissions will be, for organization. However, I've seem to have run into an issue getting the Folder model working. I'm getting the following error: </p>
  
  <pre><code>Unknown key: #&lt;ActiveRecord::Relation:0x007f17cc75d498&gt;
  </code></pre>
  
  <p>The error says it's on line 21 in this code: </p>
  
  <pre><code>18:                 &lt;/div&gt;
  19: 
  20:                 &lt;div id="submission-list-container"&gt;
  21:                     &lt;% current_user.folders.each do |i| %&gt;
  22:                         &lt;a href='#'&gt;
  23:                             &lt;div id="post-container"&gt;
  24:                                 &lt;%= i.title %&gt; &lt;p id="created-time"&gt;Created &lt;%= i.created_at.strftime("%e/%-m") %&gt;&lt;/p&gt;
  </code></pre>
  
  <p>I created the Folder model using <code>rails g model folder title:string</code> and my model looks like this:</p>
  
  <pre><code>class Folder &lt; ActiveRecord::Base
  attr_accessible :title, :user_id
  
  belongs_to :user
  has_many :submissions, order =&gt; ('updated_at DESC')
  end
  </code></pre>
  
  <p>My guess is that I might have set up the relationship between users, submissions, and folders incorrectly. Here are my user and submission models:</p>
  
  <p>submission.rb:</p>
  
  <pre><code>class Submission &lt; ActiveRecord::Base
  
  belongs_to :folder
  belongs_to :user
  
  
  attr_accessible :content, :title, :user_id
  
  
  end
  </code></pre>
  
  <p>User.rb:</p>
  
  <pre><code>class User &lt; ActiveRecord::Base
  # Include default devise modules. Others available are:
  # :token_authenticatable, :confirmable,
  # :lockable, :timeoutable and :omniauthable
  devise :database_authenticatable, :registerable,
       :recoverable, :rememberable, :trackable, :validatable
  
  # Setup accessible (or protected) attributes for your model
  attr_accessible :email, :password, :password_confirmation, :remember_me, :user_id,  :submissions, :folders
  # attr_accessible :title, :body
  
  has_many :submissions
  has_many :folders, through: :submissions
  
  end
  </code></pre>
  
  <p>Also my migrations dir look like this:</p>
  
  <pre><code>20130523233304_create_submissions.rb
  20130530064506_devise_create_users.rb
  20130621002458_add_user_id_to_submissions.rb
  20130709213421_add_user_id_to_folders.rb
  20130710042650_add_folder_id_to_submissions.rb
  20130710200424_create_folders.rb
  </code></pre>
  
  <p>Any idea what could be wrong? This is my first time experiencing this error, so I'm unsure what I've fudged up. </p>
  
  <p><strong>Edit</strong>
  Here's are the Schema.rb tables for folders and submissions: </p>
  
  <pre><code>create_table "folders", :force =&gt; true do |t|
    t.string   "title"
    t.datetime "created_at", :null =&gt; false
    t.datetime "updated_at", :null =&gt; false
  end
  
  create_table "submissions", :force =&gt; true do |t|
    t.string   "title"
    t.text     "content"
    t.datetime "created_at", :null =&gt; false
    t.datetime "updated_at", :null =&gt; false
    t.integer  "user_id"
  end
  </code></pre>
  
  <p><strong>Edit 2</strong>
  My create_folders migration: </p>
  
  <pre><code>class CreateFolders &lt; ActiveRecord::Migration
  def change
    create_table :folders do |t|
      t.string :title
  
    t.timestamps
  end
  </code></pre>
  
  <p>end
  end</p>
  
  <p>And here is my add_folder_id_to_submissions migration file: </p>
  
  <pre><code>class AddFolderIdToSubmissions &lt; ActiveRecord::Migration
    def change
    end
  end
  </code></pre>