-
-
Save cmthakur/3270524 to your computer and use it in GitHub Desktop.
API
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Try to change
describe "PagesController" do
to
describe PagesController do