Skip to content

Instantly share code, notes, and snippets.

@koos
Created August 28, 2011 16:10
Show Gist options
  • Select an option

  • Save koos/1176847 to your computer and use it in GitHub Desktop.

Select an option

Save koos/1176847 to your computer and use it in GitHub Desktop.
api example in rails 3.0
class UsersController < ApplicationController::Base
respond_to :html, :xml, :json
def index
respond_with(@users = User.all)
end
def create
@user = User.create(params[:user])
respond_with(@user, :location => users_url)
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment