문제

In my index.html.erb I have

<%= link_to 'Edit', edit_order_path(order) %>

Whenever I try to edit the order contents i got the following error:

NoMethodError in Order#index 
undefined method `edit_order_path' for #<ActionView::Base:0x13f4aeb>

How can I overcome it?

도움이 되었습니까?

해결책

Add following line of code in your routes.rb resources :orders or add following line of code in routes.rb

match 'orders/:id/edit' => 'orders#edit', :as => :edit_order

I assume, your controller name as orders and action edit. use following code for form

<% form_for(@order, :url => {:action => :update}) do |f| %>
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top