Copyright © 2011-2012
Matthew C. Smith

Action View Template Error No Route Matches


Sample Blog Post

This error threw me for a loop at first.

ActionView::Template::Error (No route matches {:action=>"confirm", :controller=>"dashboard/orders", :order_id=>#<Order id: 1, user_id: 2, location_id: 1, created_at: "2012-01-19 20:40:32", updated_at: "2012-01-19 21:23:37", tip: 15, terms: true, tax_rate: 0.0, state: "submitted", pay_state: "authorized", saved_card_id: 1, submitted_at: "2012-01-19 21:23:38", confirmed_at: nil, fulfilled_at: nil, order_type: "1", assigned_to_id: nil, canceled_at: nil, on_delivery_at: nil, undeliverable_at: nil, completed_at: nil, locked: false, delivery_instructions: "">}):
  66:       <h3>Order Status: <%= @order.state.capitalize %></h3>
  67:       <h4>Actions</h4>
  68:       <% if @order.submitted? %>
  69:         <%= link_to "Confirm", dashboard_order_confirm_path(@order), class: 'btn', remote: true, method: :post %> 
  70:         <%= link_to "Cancel", dashboard_order_cancel_path(@order), class: 'btn', remote: true, method: :post %>
  71:       <% elsif @order.confirmed? || @order.on_delivery? %>
  72:         <% if @order.delivery_order? && @order.confirmed? %>
  app/views/dashboard/orders/_status.html.erb:69:in `_app_views_dashboard_orders__status_html_erb__1685340486473368973_50902380'
  app/views/dashboard/orders/status.js.erb:1:in `_app_views_dashboard_orders_status_js_erb__3714816055410226996_36825880'

Rendered /home/matt/.rbenv/versions/1.9.3-p0/gemsets/project/gems/actionpack-3.1.3/lib/action_dispatch/middleware/templates/rescues/routing_error.erb within rescues/layout (0.4ms)

Explaination

At first it may just seem like there is not an appropriate route in config/routes.rb matching the criteria but there is. The cause of this particular error was the order instance was invalid.

So if you get this error... check if there are any errors on the record!

→ Written by Matt Smith on January 19, 2012 in Rails, Errors

blog comments powered by Disqus