Frage

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?

War es hilfreich?

Lösung

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| %>
Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow
scroll top