Routes problem in form

Hello all,

I'm relatively new to rails and have been doing ok with it but I have run into an issue that I'm sure has a really easy solution that I just can't seem to see.

Basically I have an app and have namespaced and admin section to it. I'm getting the following error:

No route matches {:action=>"show", :controller=>"admin/carriers"}

The code at fault is this

<%= form_for(@carrier, :url => admin_carrier_path, :html => { :multipart => true }) do |f| %>

Basically I'm trying to create a new carrier but the form won't render due to that error. In my routes file I have the following code.

  namespace :admin do     resources :carriers   end

And rake routes does show a route that should match. I'm using rails 3.0.3 if that is any help.

Any help would be greatly appreciated.

Hello all,

I'm relatively new to rails and have been doing ok with it but I have run into an issue that I'm sure has a really easy solution that I just can't seem to see.

Do you want admin_carriers_path? You can probably simplify things simply by saying form_for([:admin, @carrier], :html => {:multipart => true}}

Fred

Well I've figured this one out so no worries.

Thanks for that Fred! That's not what I did but it seems a better approach. I ended up doing :url => { :action => "create" }.

One further question would [:admin, @carrier] work in link_to for my destroy links? Currently i'm using admin_carrier_path(carrier).

Thanks!

yes, it will work