How do I set the url for a “semantic form” tag in an activeAdmin custom page partial for collection_action in my activeAdmin controller?
I have:
item.rb
ActiveAdmin.register Item, :as => "MyItems" do
menu :parent => "My", :label => "My Items"
collection_action :add_me, :method => :post do
redirect_to "/" # just for testing
end
end
custom page ActiveAdmin controller
ActiveAdmin.register_page "MyItemsCustomPage" do
content do
@items = Item.all
render "item", { :items => @items }
end
end
_item.html.erb (for custom page)
<%= semantic_form_for :item_add_me, :url => add_me_admin_items_path do |f| %>
<%= f.buttons :commit %>
<% end %>
And after going to the custom page I have the error:
undefined local variable or method `add_me_admin_items_path' for #<#<Class:0x00000006c3ff40>:0x00000005f8bd80>
btw, semantic form for admin_items_path works well for item add action.
PS. If I change the url to /admin/items/add_me and set the :method to :post, I get the routing error: No route matches [POST] "/admin/items/add_me"
Found the problem.
After removing
:as => "MyItems"in item.rb:All works ok.