title: Rails 4: Access model from another controller's view
body: <p>I am relatively new to rails and am writing a website for a store where I have a <code>locations_controller</code> for the multiple store locations and I also have a <code>potentialClients_controller</code> for when people fill out a form, requesting more information using their name, email, etc.  </p>
  
  <p>Through my <code>locations_controller</code> I have several views for each location, and in the location's view, I want to include a form that accesses the <code>potentialClients_controller</code>.</p>
  
  <p>Is this done through relationships or some other way?  The view below throws <code>First argument in form cannot contain nil or be empty</code> error because in this view, <code>@potential_client</code> is <code>nil</code>.  </p>
  
  <p><strong>How do I make <code>@potential_client</code> accessible?</strong></p>
  
  <p><strong>locations/Newton.html.erb</strong></p>
  
  <pre><code>&lt;div class="main-content"&gt;
      &lt;h1&gt;Newton, MA&lt;/h1&gt;
      &lt;div class="wrapper"&gt;
          &lt;div class="form-container"&gt;
              &lt;%= form_for @potential_client do |f| %&gt;
  
                  &lt;%= f.label :name %&gt;
                  &lt;%= f.text_field :name %&gt;&lt;br /&gt;
  
                  &lt;%= f.label :email %&gt;
                  &lt;%= f.email_field :email %&gt;&lt;br /&gt;
  
                  &lt;%= f.label :phone %&gt;
                  &lt;%= f.number_field :phone %&gt;&lt;br /&gt;
  
                  &lt;%= f.label :message %&gt;
                  &lt;%= f.text_field :message %&gt;&lt;br /&gt;
  
                  &lt;%= f.submit "Submit" %&gt;
  
              &lt;% end %&gt;
          &lt;/div&gt;
      &lt;/div&gt;
  &lt;/div&gt;
  </code></pre>