В ApplicationController, в соответствии с разработкой docs, How To: Redirect to a specific page on successful sign in and sign out, переключатель case, когда невозможно достичь, даже в консоль отладки pry, отображается «resource.class». Пользователь правда'. Я не знаю, какую часть обработки Rails я пропустил, любой намек будет оценен!В Rails 4 с чертой devise, переопределение after_sign_in_path_for недействительно
# ApplicationController.rb
class ApplicationController < ActionController::Base
# Prevent CSRF attacks by raising an exception.
# For APIs, you may want to use :null_session instead.
protect_from_forgery with: :exception
protected
def after_sign_in_path_for(resource)
# check for the class of the object to determine what type it is
binding.pry
case resource.class
when User
puts "user redirect ==== "
return session.delete(:return_to) || current_user_path
else
puts "super call ....."
super
end
end
end
Спасибо! Я думаю, что ваш ответ может быть лучше, если вы сможете объяснить мысли, связанные с настройкой SessionController, вместо того, чтобы переопределять ApplicationController # after_sign_in_path_for. – user746403