title: How to get values in show action in rails controller
body: <p>I would like to have access to the parameters in nested attributes..... Below is the code.</p>
  
  <pre><code>&lt;%= link_to "Invoice", user_invoice_path(@user, invoice) %&gt;
  </code></pre>
  
  <p>How do I access the user and invoice in the Invoice controller show action.</p>
  
  <pre><code>def show
    @user = User.find(params[:user_id])
    @invoice = Invoice.find(params[:id])
  end 
  </code></pre>
  
  <p>User Model:</p>
  
  <pre><code>class User &lt; ActiveRecord::Base
    has_many :invoices
  end
  </code></pre>
  
  <p>Invoice Model:</p>
  
  <pre><code>class Invoice &lt; ActiveRecord::Base
    belongs_to :user
  end
  </code></pre>
  
  <p>I know how it works when it is not nested.... Can anyone, please help?</p>