why
why

Reputation: 24851

Question with nested route in Rails3

there is my route:

 namespace :admin do
   resources :products do
      resources :medias do
        collection do
          post :update_positions
        end
      end
   end
 end

and I write one form to create media:

<%= form_for(admin_product_medias_path(@product), :html => { :multipart => true }) do |form| %>

i find that the action of the generated form is "/admin/products/123213/medias/new"

I think the rule is wrong

Upvotes: 1

Views: 55

Answers (1)

Arun Kumar Arjunan
Arun Kumar Arjunan

Reputation: 6857

<%= form_for @product, :url => admin_product_medias_path(@product), :html => { :method => :post, :multipart => true} do |f| %>
  ...
<% end %>

Upvotes: 1

Related Questions