我需要处理未连接到任何模型的自定义资源。
它应该处理GET,POST,DELETE方法。网址应为service/measure
。
所以我是这样创建的:
ActiveAdmin.register_page "Service", :namespace => :admin do
content do
link_to 'Stop measure', :admin_service_measure, method: :delete
panel "Measure RSSI" do
active_admin_form_for 'Measure' do |f|
f.inputs do
input :name
actions do
action :submit, label: "start measure"
end
end
end
end
end
page_action :measure, method: 'post', :url=>'measure' do
#do something else and
redirect_to :admin_service, notice: 'Started measure'
end
page_action :measure, method: 'delete' do
#do something and
redirect link_to :service
end
page_action :measure, method: 'get' do
#render some view
end
end