Skip to content

Instantly share code, notes, and snippets.

@cmthakur
Created August 6, 2012 04:36
Show Gist options
  • Save cmthakur/3270524 to your computer and use it in GitHub Desktop.
Save cmthakur/3270524 to your computer and use it in GitHub Desktop.
API
def show
@product = Product.find(params[:id])
respond_to do |format|
format.html # show.html.erb
format.json { render :json => @product }
format.xml { render :xml => @product }
end
end
After refactor
class ProductsController < ApplicationController
respond_to :html, :xml, :json, :js
def show
@product = Product.find(params[:id])
respond_with(@product) do |format|
format.js { render :json => @product, :callback => params[:callback] }
end
end
end
@cmthakur
Copy link
Author

cmthakur commented Aug 6, 2012

Try to change

describe "PagesController" do

to

describe PagesController do

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment