我正在编写弹出式注册。 我的麻烦是我无法覆盖注册和会话控制器。我正在使用这篇文章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
它不起作用...... 也在sessions_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。
谁能帮助我?