Don P
Don P

Reputation: 63758

Rails route is not being found

My Rails route isn't working, I get this error on load:

undefined method `accept_roomidex_requests_path' for #<#<Class:0x00000103394050>:0x000001033ac920>

Here are my (relevant) file contents:

config.rb

get '/roomidex_requests/:id/accept' => 'roomidex_requests#accept', :as => :accept_roomidex_requests_path

roomidex_requests_controller.rb

def accept
  # code to do stuff
end

some_view.rb

<%= link_to "Accept",
  accept_roomidex_requests_path(:id),
  :method => :post,
  :remote => true %>

Upvotes: 0

Views: 41

Answers (1)

markets
markets

Reputation: 7043

Try (without _path suffix in as option):

get '/roomidex_requests/:id/accept' => 'roomidex_requests#accept', :as => :accept_roomidex_requests

And probably you should change http verb to post.

Upvotes: 2

Related Questions