Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/solr/3.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 自定义RubyonRails操作将重定向到本地主机,无论发生什么情况_Ruby On Rails - Fatal编程技术网

Ruby on rails 自定义RubyonRails操作将重定向到本地主机,无论发生什么情况

Ruby on rails 自定义RubyonRails操作将重定向到本地主机,无论发生什么情况,ruby-on-rails,Ruby On Rails,我想在我的一个控制器中创建一个新操作,但我在操作中写入什么并不重要,它只是重定向到localhost 在my routes.rb中: match '/save_last_updated' => 'forum_topics#save_last_updated' 在forum_topics_controller.rb中 def save_last_updated //I tried here everything, raise error, redirect, render, but n

我想在我的一个控制器中创建一个新操作,但我在操作中写入什么并不重要,它只是重定向到localhost

在my routes.rb中:

match '/save_last_updated' => 'forum_topics#save_last_updated'
在forum_topics_controller.rb中

def save_last_updated
  //I tried here everything, raise error, redirect, render, but none of them work.
end
即使是控制台也没有多大帮助:

Processing by ForumTopicsController#save_last_updated as HTML
Redirected to http://localhost:3000/
Completed 302 Found in 24.8ms (ActiveRecord: 0.0ms)

我的总体目标是使用jquery ajax请求调用该操作,以便该操作更新数据库。

在启用过滤器之前检查是否有任何可能导致重定向的
,可能与授权相关。看起来您的操作甚至没有被执行。看起来您在控制器中设置了一些过滤器之前的
。你能保证吗?