title: Why is my instance variable always Nil in my Rails view
body: <p>The problem that I'm having is that any instance variables that I declare in my show function of Charges Controller, appears as nil in the view. If I set an instance variable to a number, it doesn't even appear in the view. My home function works perfectly with instance variables.</p>
  
  <p>This is my Controller with the Home and Show functions:</p>
  
  <pre><code>class ChargesController &lt; ApplicationController
  
  def home
      @products = Product.all
  end
  
  def show
      @product = Product.find_by(id: params[:id])
  end
  </code></pre>
  
  <p>This is my View for the Show function(show.html.erb):</p>
  
  <pre><code>&lt;h1&gt;Product Details&lt;/h1&gt;
  
  &lt;h3&gt; &lt;%= @product.name %&gt; &lt;/h3&gt;
  &lt;h4&gt; &lt;%= @product.price %&gt; &lt;/h4&gt;
  &lt;h5&gt; &lt;%= @product.description %&gt; &lt;/h5&gt;
  </code></pre>
  
  <p>This is my view for the Home function that contains the button that directs to the show page(home.html.erb)</p>
  
  <pre><code>&lt;h1&gt;Products&lt;/h1&gt;
  
  &lt;% @products.each do |product| %&gt;
     &lt;br&gt;
  
     &lt;p&gt; &lt;%= product.name %&gt;: $&lt;%= product.price %&gt; &lt;/p&gt;
     &lt;p&gt; &lt;%= product.description %&gt; &lt;/p&gt;
  
     &lt;%= button_to "Product Details", charge_path(product.id), :method =&gt; "get" %&gt;
     &lt;br&gt;
  
  &lt;%end%&gt;
  </code></pre>
  
  <p><a href="https://i.stack.imgur.com/ceERk.png" rel="nofollow noreferrer">error message I'm receiving</a></p>