The input form has been created in the active_admin :

 <%= semantic_nested_form_for @item, :url => admin_items_path do |f| %> <fieldset class="inputs"> <ol> <%= f.input :category %></br> <%= f.input :title %> <%= f.input :photo1 %> <%= f.input :photo2 %> </ol> </fieldset> <%= f.fields_for :ItemColors do |i| %> <fieldset class="inputs"> <ol> <%= i.input :DetailColor %> <%= i.input :size, :input_html => { :size => "10" } %> <%= i.link_to_remove "remove" %> </ol> </fieldset> <% end %> <%= f.link_to_add "add", :ItemColors %> <%= f.actions %> <% end %> 

When you create a new Item everything normally creates and sends to the page of the created Item , but if you make an update existing one, the routes error occurs, although this path exists:

 No route matches [PUT] "/admin/items" 

If you change the first line of the partial to:

<%= semantic_nested_form_for @item, :url => admin_items_path(@item) do |f| %>

It turns out:

 No route matches [PUT] "/admin/items.150" #или другой item_id 

rake routes:

 batch_action_admin_items POST /admin/items/batch_action(.:format) admin/items#batch_action admin_items GET /admin/items(.:format) admin/items#index POST /admin/items(.:format) admin/items#create new_admin_item GET /admin/items/new(.:format) admin/items#new edit_admin_item GET /admin/items/:id/edit(.:format) admin/items#edit admin_item GET /admin/items/:id(.:format) admin/items#show PUT /admin/items/:id(.:format) admin/items#update DELETE /admin/items/:id(.:format) admin/items#destroy 

Tell me, what could this be?


It is not clear where the point in the request address is taken from.

  • Asking such a question, you need to show what rake routes issues. Otherwise, you can read the tea leaves. - Vladimir Gordeev
  • thanks for the reply, I added rake routes, in general, I didn’t add it right away because all routes in this case come from active_admin itself: ActiveAdmin.routes (self) - Metallicolis

1 answer 1

I think here instead of :url => admin_items_path you need :url => admin_item_path(@item)

  • then I get No route matches [PUT] "/admin/items.150" 150 - id item - Metallicolis
  • strange, there should not be a point - Vladimir Gordeev
  • I also think that should not be), it is not clear where it comes from - Metallicolis
  • as it turned out, for Update it should be like this: admin_item_path () - Metallicolis