【发布时间】:2014-02-05 19:25:12
【问题描述】:
我已经尝试过 Devise 的 github 上的代码。在我的应用程序控制器中,我有:
after_filter :store_location
def store_location
# store last url - this is needed for post-login redirect to whatever the user last visited.
if (request.fullpath != "/users/sign_in" &&
request.fullpath != "/users/sign_up" &&
request.fullpath != "/users/password" )
session[:previous_url] = request.fullpath
puts 'stores location'
end
end
def after_update_path_for(resource)
session[:previous_url] || dashboard_path
puts 'after update'
end
当我检查我的服务器时,store_location 方法中的 puts 语句会出现,但 after_update_path_for 中的 puts 语句不会出现。如何让 after_update_redirect 工作?
这是设计说要做的,但它不起作用:
【问题讨论】:
-
有人有什么想法吗?我想不通。
标签: ruby-on-rails ruby model-view-controller devise ruby-on-rails-4