Reputation: 41874
When creating objects in ActiveAdmin I typically need to add multiple, and wish there was an option to add another object on the show page (which appears after submitting the new object).
I have been doing this model by model:
ActiveAdmin.register Color do
action_item :add, only: :show do
link_to "New", new_administration_color_path
end
end
Upvotes: 1
Views: 894
Reputation: 5038
Add this to admin/administration_color.rb
controller do
def create
create! do |format|
format.html { redirect_to admin_administration_color_path(resource, add_more: true) }
end
end
end
and some modified your code
action_item :add, only: :show do
link_to "New", new_administration_color_path if params['add_more'] == true
end
Upvotes: 1