我有一个命名空间控制器(访谈)
namespace :recruitment do
resources :interviews
end
我创建了一个路径(名称空间之外)
get "myinterviews", to: "recruitment/interviews#my", as: :myinterviews
因此/ myinterviews向用户显示他自己的采访 虽然rails似乎找到了正确的视图,但它完全跳过了控制器动作
def my
puts "Hi there"
exit
@recruitment_interviews=current_user.interviews
puts @recruitment_interviews.inspect
end
这是Recruitments :: InterviewController内部的课程。 渲染视图(招募/访谈#my)(由于找不到recruitment_interviews,因此会导致错误 这是进程日志:
Started GET "/myinterviews" for 127.0.0.1 at 2015-07-03 18:54:48 +0530
Processing by Recruitment::InterviewsController#my as HTML
Rendered recruitment/interviews/my.html.slim within layouts/application (3.7ms)
User Load (0.2ms) SELECT `users`.* FROM `users` WHERE `users`.`id` = 2 ORDER BY `users`.`id` ASC LIMIT 1
Rendered layouts/_navbar.html.slim (2.4ms)
Completed 200 OK in 199ms (Views: 197.6ms | ActiveRecord: 0.2ms)