1

我正在写弹出式注册。我的麻烦是我无法覆盖注册和会话控制器。我正在使用这篇文章http://casperfabricius.com/site/2010/09/30/ajax-sign-in-and-sign-up-with-devise/

在 registrations_controller.rb 我放:

     def after_sign_up_path_for(resource)
      edit_user_registration_path(current_user)
    end

它不起作用......也在 session_controller 中:

 class SessionsController < Devise::SessionsController
    def sign_in_and_redirect(resource_or_scope, resource=nil)
      scope = Devise::Mapping.find_scope!(resource_or_scope)
    resource ||= resource_or_scope
    redirect_url = stored_location_for(scope)
    respond_to do |format|
      format.js do
        sign_in(scope, resource) unless warden.user(scope) == resource
       if redirect_url.present?
          redirect_url = "#{redirect_url}.js" unless redirect_url[-3..-1] == '.js'
          redirect_url += redirect_url.match(/\?/) ? '&' : '?'
          redirect_url += "after_authentication=true"
          redirect_to redirect_url
        else
          render(:update) do |page|
          page << render('/shared/after_authentication')
        end
       end
    end
       format.html { super }
      end
    end
   end

我认为我的路线有问题:

devise_for :users, :controllers => {:sessions => '/sessions', :registrations => '/registrations'}

我更改了 devise.rb 并添加了 custom_failure.rb。

谁能帮我 ?

4

0 回答 0