title: Rails - Couldn't find Student with 'id'=
body: <p>I'm getting the error above when I try to create a a 'mark' for a 'student'. I can't figure out how to pass the :student_id when I create a new mark. </p>
  
  <p>Routes</p>
  
  <pre><code>Rails.application.routes.draw do
  
  
  resources :students do
  resources :marks
  end
  
  resources :marks
  
  root 'students#index'
  </code></pre>
  
  <p>Marks Controller</p>
  
  <pre><code>class MarksController &lt; ApplicationController
  def create
      @student = Student.find(params[:student_id])
      @mark = @student.marks.create(params[:input1, :input2, :input3, :weight1, :weight2, :weight3, :mark1, :mark2, :mark3, :final_mark].permit(:input1, :input2, :input3, :weight1, :weight2, :weight3, :mark1, :mark2, :mark3, :final_mark))
      @mark.save
  
      if @mark.save
          redirect_to student_path(@student)
      else
          render 'new'
      end
  end
  
  def new
      @mark = Mark.new
  end
  
  private 
    def set_mark
      @mark = Mark.find(params[:id])
    end
  
  end
  </code></pre>
  
  <p>Students Show View</p>
  
  <pre><code>    &lt;p id="notice"&gt;&lt;%= notice %&gt;&lt;/p&gt;
  
      &lt;p&gt;
       &lt;strong&gt;Student Number&lt;/strong&gt;
      &lt;%= @student.StudentNumber %&gt;
  &lt;/p&gt;
  
  &lt;p&gt;
    &lt;strong&gt;Project Title&lt;/strong&gt;
    &lt;%= @student.ProjectTitle %&gt;
  &lt;/p&gt;
  
  &lt;p&gt;
    &lt;strong&gt;Project PDF&lt;/strong&gt;
    &lt;%= @student.ProjectTitle %&gt;
  &lt;/p&gt;
  
  &lt;p&gt;
    &lt;strong&gt;Reader 1&lt;/strong&gt;
    &lt;%= @student.Reader1 %&gt;
  &lt;/p&gt;
  
  &lt;p&gt;
    &lt;strong&gt;Reader 2&lt;/strong&gt;
    &lt;%= @student.Reader2 %&gt;
  &lt;/p&gt;
  
  &lt;h3&gt; &lt;%= link_to 'Add Mark', new_student_mark_path(@student), class:"btn btn-warning"%&gt; &lt;/h3&gt;
  
  &lt;p&gt;
    &lt;strong&gt;Reader 3&lt;/strong&gt;
    &lt;%= @student.Reader3 %&gt;
  &lt;/p&gt;
  
  &lt;%= link_to 'Edit', edit_student_path(@student) %&gt; |
  &lt;%= link_to 'Back', students_path %&gt;
  </code></pre>
  
  <p>Marks Form</p>
  
  <pre><code>&lt;%= form_for @mark, html: {multipart: true} do |f| %&gt;
    &lt;% if @mark.errors.any? %&gt;
      &lt;div id="error_explanation"&gt;
        &lt;h2&gt;&lt;%= pluralize(@mark.errors.count, "error") %&gt; prohibited this grading from being saved:&lt;/h2&gt;
  
        &lt;ul&gt;
        &lt;% @mark.errors.full_messages.each do |message| %&gt;
          &lt;li&gt;&lt;%= message %&gt;&lt;/li&gt;
        &lt;% end %&gt;
        &lt;/ul&gt;
      &lt;/div&gt;
    &lt;% end %&gt;
  
    &lt;div class="field"&gt;
      &lt;%= f.label 'Introduction' %&gt;&lt;br&gt;
      &lt;%= f.text_area :input1 %&gt;
      &lt;%= f.number_field :weight1 %&gt;
      &lt;%= f.number_field :mark1 %&gt;
    &lt;/div&gt;
    &lt;div class="field"&gt;
      &lt;%= f.label 'Main' %&gt;&lt;br&gt;
      &lt;%= f.text_area :input2 %&gt;
      &lt;%= f.number_field :weight2 %&gt;
      &lt;%= f.number_field :mark2 %&gt;
    &lt;/div&gt;
    &lt;div class="field"&gt;
      &lt;%= f.label 'Conclusion' %&gt;&lt;br&gt;
      &lt;%= f.text_area :input3 %&gt;
      &lt;%= f.number_field :weight3 %&gt;
      &lt;%= f.number_field :mark3 %&gt;
    &lt;/div&gt;
    &lt;div class="actions"&gt;
      &lt;%= f.submit class:"btn-xs btn-success"%&gt;
    &lt;/div&gt;
  
  &lt;% end %&gt;
  </code></pre>
  
  <p>Mark model </p>
  
  <pre><code>class Mark &lt; ActiveRecord::Base
    belongs_to :student
  end
  </code></pre>
  
  <p>Student Model </p>
  
  <pre><code>class Student &lt; ActiveRecord::Base
  
  has_many :marks 
  
  has_attached_file :document
  validates_attachment :document, :content_type =&gt; { :content_type =&gt; %w(application/pdf) }
  end
  </code></pre>
  
  <p>It's probably something really stupid but if anyone could explain the problem I'd be really grateful.</p>
  
  <p>Thanks</p>