0

My view is the users show page

<%= link_to 'Cancel?', {:url => schedule_path,
                        :id => current_user.schedules[0].id,
                        :confirm => "are you sure?",
                        :method => :delete} %>

Associations

has_many :schedules
belongs_to :user

routes.rb

resources :schedules 
resources :users  

I don't match anything in routes.rb. The parameters in the stack trace show id => 93, which is what I want as I'm trying to destroy the schedule with id 93. But it's routing to the show action of the user's controller when I want the destroy action of the schedule's controller. Thanks for any help.

sam-w
  • 7,478
  • 1
  • 47
  • 77
Michael Leveton
  • 333
  • 2
  • 7
  • 16

1 Answers1

3

Try to link_to 'Cancel?', schedule_path(current_user.schedules[0]), :confirm => "are you sure?", :method => :delete

abonec
  • 1,379
  • 1
  • 14
  • 23