- I'm building an store app that include a product catalog, details
page, and cart.
- I'm attempting to put them in the same layout using partials.
- Product catalog is the index action of the store controller
- I can get the cart on the page by adding @cart = find_cart to the
"def index" block. If there's not a cart already, find_cart creates one
I can't get the details view to be on the index page layout. I need
@product for the details view but I can't just add "@product =
Product.find(params[:id]) to the "def index" block because the I'll get
a RecordNotFound as there's not a product selected intially.
What should I do to get around this problem?
And while I'm at it, whats a better way to say "the 'def index' block"?