A typical form in Active Admin looks like this one
form do |f|
f.inputs "New Post" do
f.input :title,
f.input :body
end
f.actions
end
This will give you the standard buttons: create and cancel
Now in my case I need to redirect my user to a specific page when the cancel button is hit
This can be achieved in this way:
form do |f|
f.inputs "New Post" do
f.input :title,
f.input :body
end
f.actions do
f.action(:submit)
f.cancel_link(admin_anothermodel_path)
end
end
This is simple and effective way to redirect your user to the location you want
Nessun commento:
Posta un commento