Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/ruby-on-rails-3/4.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Ruby on rails 设计自定义重定向后不执行操作_Ruby On Rails_Ruby On Rails 3_Ruby On Rails 3.1_Devise - Fatal编程技术网

Ruby on rails 设计自定义重定向后不执行操作

Ruby on rails 设计自定义重定向后不执行操作,ruby-on-rails,ruby-on-rails-3,ruby-on-rails-3.1,devise,Ruby On Rails,Ruby On Rails 3,Ruby On Rails 3.1,Devise,在自定义Desive重定向到call之后,我想执行一个类似的操作,我有一个名为stories controller的控制器和一个before筛选器,其中显示 befroe\u过滤器:对用户进行身份验证它将我重定向到登录页面,但不会在登录后将我发送回上一个请求。我的代码如下 def after_sign_in_path_for(resource) user_profile_path(current_user) end 如何在登录后像新操作一样重定向到上一个操作。将其更改为:

在自定义Desive重定向到call之后,我想执行一个类似的操作,我有一个名为stories controller的控制器和一个before筛选器,其中显示

befroe\u过滤器:对用户进行身份验证它将我重定向到登录页面,但不会在登录后将我发送回上一个请求。我的代码如下

  def after_sign_in_path_for(resource)
      user_profile_path(current_user)
  end
如何在登录后像新操作一样重定向到上一个操作。

将其更改为:

def after_sign_in_path_for(resource)
  stored_location_for(resource) || user_profile_path(current_user)
end