S
S
schurenkov2016-08-05 11:52:39
Ruby on Rails
schurenkov, 2016-08-05 11:52:39

How to update content with ajax on user authorization via devise?

There is such a design on the main page, how to make it update with ajax during authorization, authorization through Devise

<% if current_user %>
              <li><a><%= "Hello, #{current_user.fullname}" %></a></li>
              <li><%= link_to "Sign out", destroy_user_session_path, :method => :delete %></li>
          <% else %>
          <li><a href="#create_user_modal" class="modal_fancy">Регистрация</a></li>
          <li><a href="#login_modal" class="modal_fancy">Вход</a></li>
          <% end %>

jquery error handling via json
$("#login ").bind("ajax:success", function(event, xhr, settings){
     
    });


class SessionsController < Devise::SessionsController
  respond_to :html, :json
end


Ruby 2.2
Rails 5.0

Answer the question

In order to leave comments, you need to log in

1 answer(s)
V
V, 2016-08-07
@schurenkov

https://hackhands.com/sign-users-ajax-using-devise...

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question