我想在我的一个控制器中创建一个新动作,但是我写入它只是重定向到localhost的动作并不重要。
在我的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请求调用该操作,以便操作更新数据库。