Skip to content

Instantly share code, notes, and snippets.

@johndavid400
Created August 8, 2012 15:12
Show Gist options
  • Save johndavid400/3295777 to your computer and use it in GitHub Desktop.
Save johndavid400/3295777 to your computer and use it in GitHub Desktop.
def create
authenticate_user!
if user_signed_in?
respond_to do |format|
format.html {
flash.notice = t(:logged_in_succesfully)
redirect_back_or_default(products_path)
}
format.js {
user = resource.record
render :json => {:ship_address => user.ship_address, :bill_address => user.bill_address}.to_json
}
end
else
flash.now[:error] = t('devise.failure.invalid')
render :new
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment