在ActiveAdmin中,当我在仪表板上按下action_item时,我正试图从表单中获取值,但我不确定如何做到这一点,这是我到目前为止,它运行,但我希望能够为不同的方法调用传递参数。
ActiveAdmin.register_page "Dashboard" do
menu :priority => 1, :label => proc{ I18n.t("active_admin.dashboard") }
page_action :scrape, :method => :post do
#The scraper works, but I don't know how to pass the info
#from the form from below into this method
# scrape = Scraper.new
# scrape.scrape
redirect_to admin_dashboard_path, :notice => "Ran the scraper!"
end
action_item do
link_to "Run Scraper", admin_dashboard_scrape_path, :method => :post
end
content :title => proc{ I18n.t("active_admin.dashboard") } do
panel "Run Course Scraper" do
para "Run the course webscraper to pull current class list and insert into the Course table in the database"
form do |f|
f.input "Session"
end
end
end
end
我想从表单中获取输入表单,其中会话传递给page_action:以某种方式刮取任何想法?
答案 0 :(得分:-1)
您可以尝试将控制器操作添加到仪表板页面并将f.buttons添加到表单等。
我猜也应该使用javascript。