Skip to content

Instantly share code, notes, and snippets.

@simi
Created April 19, 2011 16:21
Show Gist options
  • Select an option

  • Save simi/928663 to your computer and use it in GitHub Desktop.

Select an option

Save simi/928663 to your computer and use it in GitHub Desktop.
Routing problem :(
# rake routes:
customer_zone_order_messages POST /zakaznicka_zona/orders/:order_id/messages(.:format) {:action=>"create", :controller=>"customer_zone/messages"}
# routes.rb:
scope(:path => 'my_path', :module => :customer_zone, :as => 'customer_zone') do
resources :orders, :only => :show do
resources :messages, :only => :create
end
end
# Controller app/controllers/customer_zone/messages_controller.rb
module CustomerZone
class MessagesController < ApplicationController
before_filter :authenticate_zone_user!
layout 'customer_zone'
def create
...
redirect_to customer_zone_order_path(@order)
end
end
end
# Form _form.html.erb
<%= form_for(@message, :url => customer_zone_order_messages) do |f| %>
# result
ActionController::RoutingError: No route matches {:action=>"create", :controller=>"customer_zone/messages"}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment