Created
April 21, 2015 14:17
-
-
Save matiasmoya/aff67cd65f4f0e1ddae5 to your computer and use it in GitHub Desktop.
Devise ajax
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class DeviseSessionsController < Devise::SessionsController | |
clear_respond_to | |
respond_to :json | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<h2>Sign in</h2> | |
<%=simple_form_for :user, url: session_path(:user), remote: true, html: {id: 'user_sign_in'} do |f| %> | |
<%= f.input :username %> | |
<%= f.input :password %> | |
<%= f.button :submit %> | |
<%end%> | |
<h2>Sign up</h2> | |
<%=simple_form_for :user, url: registration_path(:user) do |f|%> | |
<%= f.input :username %> | |
<%= f.input :password %> | |
<%= f.input :password_confirmation %> | |
<%= f.button :submit %> | |
<%end%> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class RegistrationsController < Devise::RegistrationsController | |
clear_respond_to | |
respond_to :json | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Rails.application.routes.draw do | |
#sobrescribir los controllers de devise que partician en el login / sign in para que respondan json | |
devise_for :users, :controllers => { omniauth_callbacks: "users/omniauth_callbacks", sessions: 'devise_sessions', registrations: 'registrations' } | |
devise_scope :user do | |
post '/users/fbasync' => "users/omniauth_callbacks#facebook_async" | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment