title: Passing Parameters to Create Controller Rails
body: <p>I am getting this error: Couldn't find Blog without an ID. In my parameters I am passing a blog_id so I am not sure what I should do here to allow a comment to be created</p>
  
  <p>Here is my parameters being passed on the error page:</p>
  
  <pre><code>     {"utf8"=&gt;"✓",
       "authenticity_token"=&gt;"b4+gKNVpEk2Bc2BBjZTiQ8CJchmOo6Bca4SU4e+2mHc1l8blRkeODrAbRw   xKZzI+FadXksgi5rtKbutXKfkSLw==",
       "comment"=&gt;{"first_name"=&gt;"Johnny",
       "last_name"=&gt;"Manziel ",
        "content"=&gt;"lkfewfewfkwekfwefioweifjiewf 4iwef ew",
        "blog_id"=&gt;"6"},
        "commit"=&gt;"Post"}
  </code></pre>
  
  <p>In Comment Controller:</p>
  
  <pre><code>      def create
        @blog = Blog.find(params[:blog_id])
        @comment = @post.comments.create!(comment_params)
        redirect_to @blog
        end
  </code></pre>
  
  <p>In views: </p>
  
  <pre><code>    &lt;ul class="media-list"&gt;
    &lt;li class="media"&gt;
      &lt;% comment = Comment.new %&gt;
      &lt;% comment.blog_id = @blog.id %&gt;
      &lt;% if current_user.present?  %&gt;
      &lt;% comment.user_id = current_user.id %&gt;
      &lt;% end %&gt;
      &lt;%= form_for comment do |f| %&gt;
       &lt;% if current_user.present? %&gt;
      &lt;%= f.hidden_field :user_id, value = current_user.id %&gt;
      &lt;% else %&gt;
      &lt;div class="row"&gt;
      &lt;div class="col-sm-6"&gt;
      &lt;%= f.text_field :first_name, class: 'form-control',:placeholder =&gt; "Please Add Your First Name To Comment"  %&gt;
      &lt;/div&gt;
  
      &lt;div class="col-sm-6"&gt;
      &lt;%= f.text_field :last_name, class: 'form-control', :placeholder =&gt; "Please Add Your Last Name To Comment"%&gt;
      &lt;/div&gt;
      &lt;/div&gt;
      &lt;% end %&gt;
      &lt;br&gt;
      &lt;%= f.text_area :content, class: 'form-control', :placeholder =&gt; "Add your comment", rows: 3 %&gt;
      &lt;br&gt;
      &lt;%= f.hidden_field :blog_id %&gt;
      &lt;div class="row pull-right"&gt;
        &lt;div class="col-lg-6"&gt;
        &lt;%= f.submit "Post", :class=&gt; "btn-u btn-brd btn-brd-hover rounded-2x btn-u-blue" %&gt;
        &lt;/div&gt;
      &lt;/div&gt;
      &lt;% end %&gt;
    &lt;/li&gt;
  &lt;/ul&gt;
  </code></pre>