Skip to content

Instantly share code, notes, and snippets.

@joshmvandercom
Created March 13, 2012 05:41
Show Gist options
  • Save joshmvandercom/2027034 to your computer and use it in GitHub Desktop.
Save joshmvandercom/2027034 to your computer and use it in GitHub Desktop.
respond_to
class UsersController < ApplicationController
def index
@users = User.all
respond_to do |format|
format.html # renders index.html.erb
format.json { render :json => @users }
format.xml { render :xml => @users }
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment