我的应用程序中有一个看起来正确的资源,但是当我打开索引时,我得到一个错误:undefined local variable or method 'new_beta_request_path'
. 这beta_request_approval path
也发生了。
我的链接看起来像<%= link_to 'New Beta Request', new_beta_request_path, :class => "btn" %>
和<%= link_to "Approve", beta_request_approval_path %>
。
所有的路径对我来说似乎都是正确的,但显然缺少一些东西......
在我的routes.rb
,我有:
resources :beta_requests, :only => [:index, :edit, :create, :update, :destroy]
match '/request_invite', to: 'beta_requests#new', :as => "request_invite"
match 'beta_requests/:id/approve', to: 'beta_requests#approve', :as => "beta_request_approval", :via => :put
当我运行 Rake Routes 时,我得到以下信息:
beta_requests GET /beta_requests(.:format) beta_requests#index
POST /beta_requests(.:format) beta_requests#create
edit_beta_request GET /beta_requests/:id/edit(.:format) beta_requests#edit
beta_request PUT /beta_requests/:id(.:format) beta_requests#update
DELETE /beta_requests/:id(.:format) beta_requests#destroy
request_invite /request_invite(.:format) beta_requests#new
beta_request_approval POST /beta_requests/:id/approve(.:format) beta_requests#approve
谁能看到我显然看不到的东西?