Skip to content

Instantly share code, notes, and snippets.

@amaanr
Created May 9, 2013 18:01
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save amaanr/5549275 to your computer and use it in GitHub Desktop.
Save amaanr/5549275 to your computer and use it in GitHub Desktop.
App.register = (route) ->
$.ajax
url: App.urls.register
type: "POST"
data:
"person[email]": route.currentModel.email
"person[password]": route.currentModel.password
"person[password_confirmation]": route.currentModel.password_confirmation
success: (data) ->
App.currentPerson = data.person
App.LoginStateManager.transitionTo "authenticated"
route.transitionTo 'home'
error: (jqXHR, textStatus, errorThrown) ->
route.controllerFor('registration').set "errorMsg", "That email/password combo didn't work. Please try again"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment