我想创建一个新动作,我称之为“showemployees”。这就是我已经做的:
-> 在控制器中:
def showemployees
end
-> 创建 app/views/employees/showemployees.html.erb
-> 在配置/路由中
match "/employees/showemployees" => "employees#showemployees"
我认为现在通过localhost:3000/employees/showemployees打开 showemployees.html.erb 就足够了,但似乎 Rails 仍然通过 show 操作(来自资源:employees)进行路由并且不采取 showemployees-action,因为它告诉我
ActiveRecord::RecordNotFound in EmployeesController#show
Couldn't find Employee with ID=showemployees
我需要更改什么才能让 Rails 采取 showemployees-action?
我的路线的源代码:
System::Application.routes.draw do
match "/employees/showemployees" => "employees#showemployees" #für showemployees.html.erb
root :to => "employees#index"
resources :course_to_dos
resources :current_qualifications
resources :expected_qualifications
resources :skills
resources :employees
resources :positions
resources :admin
end