2013-05-19 22 views
1

在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形式:刮不知何故,任何想法?

回答

-1

,你可以尝试控制器动作添加到仪表板页面并添加f.buttons到窗体等

使用JavaScript也应该工作,我猜。