我正在重写我 5 年前使用 rails 1.something 完成的 Rails 应用程序。当我尝试浏览 localhost/companies/search_updates/ 时出现此错误...我知道这是一个路由错误,因为当我从 router.rb 中删除资源 :companies 时,一切正常...如何解决?我是否需要为我创建的每个操作手动添加路由?
当我尝试访问 localhost/companies/search_updates/ 时出错
The action 'show' could not be found for CompaniesController
控制器
class CompaniesController < ApplicationController
def index
@companies = Company.all
end
def search_updates
# Execute code to search for updates
# Redirect to results
end
end
路线
resources :accounts
resources :companies
get 'companies/search_updates' => 'companies#search_updates'
search_updates.html.erb
Hello Updates!