I am creating a custom form in Active Admin 0.5. I have registered a page and created a form through the DSL:
ActiveAdmin.register_page 'Planning', :namespace => :pos_admin do
content :title => proc{ I18n.t("active_admin.dashboard") } do
form do |f|
f.input :type => :text
f.input :type => :submit
end
end
end
The problem is that when submitting the form I get an empty Params hash. And the form tag contains no authenticity token.
What am I doing wrong?
An old post, but for anyone stumbling upon this issue, the answer is to add
f.input :name => 'authenticity_token', :type => :hidden, :value => form_authenticity_token.to_s
to the form. This passes the auth token back to ActiveAdmin so that it can confirm no forgery has taken place. Your session was being terminated and you were taken back to the login screen because ActiveAdmin thought you were trying to forge a submission.
Your form should now look like this
form do |f|
f.input :name => 'authenticity_token', :type => :hidden, :value => form_authenticity_token.to_s
f.input :type => :text
f.input :type => :submit
end
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With