Skip to content

Instantly share code, notes, and snippets.

@tknazn
tknazn / registrations_controller.rb
Created September 22, 2012 07:45 — forked from evanbeard/registrations_controller.rb
API JSON authentication with Devise
class Api::RegistrationsController < Api::BaseController
respond_to :json
def create
user = User.new(params[:user])
if user.save
render :json=> user.as_json(:auth_token=>user.authentication_token, :email=>user.email), :status=>201
return
else