activeAdmin 컨트롤러의 collection_action 부분 인 activeAdmin 사용자 정의 페이지에서 "의미 적 양식"태그의 URL을 어떻게 설정합니까?ActiveAdmin 수집 작업 경로
내가 가진 :
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
item.rb 사용자 정의 페이지 ActiveAdmin을 컨트롤러
ActiveAdmin.register_page "MyItemsCustomPage" do
content do
@items = Item.all
render "item", { :items => @items }
end
end
_item.html.erb (사용자 정의 페이지)
<%= semantic_form_for :item_add_me, :url => add_me_admin_items_path do |f| %>
<%= f.buttons :commit %>
<% end %>
그리고 관례에 간 후에
undefined local variable or method `add_me_admin_items_path' for #<#<Class:0x00000006c3ff40>:0x00000005f8bd80>
이 BTW, admin_items_path
에 대한 의미 론적 형태가 아니라 작업을 추가 항목에 대한 작동
추신. URL을 /admin/items/add_me
으로 변경하고 :method
을 :post
으로 설정하면 라우팅 오류가 발생합니다. No route matches [POST] "/admin/items/add_me"