Skip to content

Instantly share code, notes, and snippets.

@mgonto
Created February 26, 2013 03:11
Show Gist options
  • Save mgonto/5035552 to your computer and use it in GitHub Desktop.
Save mgonto/5035552 to your computer and use it in GitHub Desktop.
Json controller
class UsersController < ApplicationController
respond_to :json
before_filter :authenticate_user!, :only => :destroy
def create
@user = User.new(params[:user])
if @user.save
respond_with @user, status: :created
else
render json: @user.errors, status: :unprocessable_entity
end
end
def destroy
end
def login
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment