title: How to render partial view of one controller to another controller in ruby on rails
body: <p>Hi I am trying to implement subscribe button in vendor site so need to render a subscribe form with hidden attribute for vendor_site_id. The form work fine within the scope of subscription controller but I need to render it in vendor_site/show page as partial _new.html.erb. I couldn't figure out the way to fix this problem at my own can any body suggest me with this problem.</p>
  
  <p>My partial view subscriptions/_new.html.erb</p>
  
  <pre><code>&lt;%= form_for(@subscription) do |f| %&gt;
    &lt;div class="field"&gt;
      &lt;%= f.hidden_field @subscription.vendor_site_id, :value=&gt;"1" %&gt;
    &lt;/div&gt;
    &lt;%= button_tag(type: 'submit', class: "btn btn-primary") do %&gt;
      &lt;i class="fa fa-user fa-fw"&gt;&lt;/i&gt; Subscribe
    &lt;% end %&gt;
  &lt;% end %&gt;
  </code></pre>
  
  <p>Now when I render this in vendor_sites/index.html.erb</p>
  
  <pre><code>&lt;h3&gt;This is vendor site with id 1 just for the testing of subscription method&lt;/h3&gt;
  &lt;%= render :partial =&gt; "subscriptions/new" %&gt;
  </code></pre>
  
  <p>it throws a error which says:</p>
  
  <pre><code>First argument in form cannot contain nil or be empty
  </code></pre>
  
  <p>which I understood so far is that I need to tell this vendor_site controller about the @subscription from other scope.
  But I cannot figure out how?
  My subscriptions class looks like this:</p>
  
  <pre><code>class SubscriptionsController &lt; ApplicationController
    def new
      @subscription=Subscription.new
    end
  end
  </code></pre>