I have a rails 3 application which uses the ActiveAdmin gem.
Is there a way to make a form in the dashboard page. A form that is not related to any models ? In my case, a form to select time period to display some stats ?
I have tried :
form do |f|
f.inputs "test" do
f.input :time, label: "Duration", as: :select, collection: [['24h', 24], ['1 week', '1w'], ['1 month', '1m']]
end
f.actions
end
But i'm getting an "undefined methods errors" for f.inputs
. Does someone have an idea ?
You probably need to create a form partial like this:
-# admin/whatever/_form.html.haml
= semantic_form_for 'whatever', :url => admin_whatevers_path do |f|
= f.inputs :name => 'tests' do %>
= f.input :time, collection: [['24h', 24], ['1 week', '1w'], ['1 month', '1m']]
and tell activeadmin to use the partial like this:
#admin/whatever.rb
form :partial => 'form'
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.