title: Rails undefined method * for nil:NilClass
body: <p>I am having an issue and I have done some reasearch, from my research I have found that the variable that is being used is empty, however I am unsure as to why it is empty, Maybe its something obvious to someone else?</p>
  
  <p>I am trying to display a nested form on a page from another controller, I am used nested resources, Which I think might be my issue, but unsure how to resolve it.</p>
  
  <p><strong>Getting the following error:</strong></p>
  
  <pre><code>undefined method `submission' for nil:NilClass
  </code></pre>
  
  <p>Structure of Project 
  Main Folders
  -Members 
  --Questions
  --Submissions</p>
  
  <p><strong>Concept:</strong></p>
  
  <p>Question - has_many - Submissions
  Submission - Belongs_to - Question</p>
  
  <p><strong>Submission Model:</strong></p>
  
  <pre><code>class Submission &lt; ActiveRecord::Base
      belongs_to :question
      belongs_to :member
  end
  </code></pre>
  
  <p><strong>Question Model:</strong></p>
  
  <pre><code>class Members::Question &lt; ActiveRecord::Base
    has_many :submissions
  end
  </code></pre>
  
  <p><strong>Submissions Controller:</strong></p>
  
  <pre><code>def create
  
          @question =  Members::Question.find(params[:question_id])
          @submission.member_id =  current_member.id
          @submission = @question.submissions.create(params[:submission].permit(:content, :question_id))
  
  *Redirect Method Here * 
  
  end
  </code></pre>
  
  <p>In the form I am using the following method:</p>
  
  <pre><code>&lt;%= form_for([@question, @question.submission.build]) do |f| %&gt;
    &lt;% if @submission.errors.any? %&gt;
      &lt;div id="error_explanation"&gt;
        &lt;h2&gt;&lt;%= pluralize(@submission.errors.count, "error") %&gt; prohibited this submission from being saved:&lt;/h2&gt;
  
        &lt;ul&gt;
        &lt;% @submission.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 :content %&gt;&lt;br&gt;
      &lt;%= f.text_area :content %&gt;
    &lt;/div&gt;
  
    &lt;div class="actions"&gt;
      &lt;%= f.submit %&gt;
    &lt;/div&gt;
  &lt;% end %&gt;
  </code></pre>
  
  <p>And then to display the form on the show page of the question, I am using </p>
  
  <pre><code>&lt;%= render 'members/submissions/form' %&gt;
  </code></pre>
  
  <p><strong>Routes:</strong></p>
  
  <pre><code>  namespace :members do
      resources :questions,  only: [:index,:show] do
        resources :submissions 
      end
    end
  </code></pre>
  
  <p>Any one any ideas where I am going wrong?</p>
  
  <p>Any help is appreciated.</p>