Skip to content

Instantly share code, notes, and snippets.

@mb-dev
Created February 5, 2013 05:18
Show Gist options
  • Select an option

  • Save mb-dev/4712358 to your computer and use it in GitHub Desktop.

Select an option

Save mb-dev/4712358 to your computer and use it in GitHub Desktop.
Master Detail Page - Product Controller
class ProductsController < ApplicationController
def index
@products = Product.all
if params[:product_id].present?
@product = Product.find(params[:product_id])
end
if params[:product_id].present? and request.xhr?
render 'product', layout: false
end
# else - render regular index page
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment