I have a resource in my application that seems correct but when I open index, I get an error: undefined local variable or method 'new_beta_request_path'. This happens with beta_request_approval path also.
My links look like <%= link_to 'New Beta Request', new_beta_request_path, :class => "btn" %> and <%= link_to "Approve", beta_request_approval_path %>.
All of the paths seem correct to me but something is obviously missing…
In my routes.rb, I have:
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
When I run Rake Routes, I get the following:
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
Can anyone see what I apparently cannot?
There’s no
:newin theonlyarray? You can either add it:or remove the hash argument entirely, since this way all resource actions are defined anyway.