@@ -3,9 +3,6 @@ module DSL
33
44 def scoped_collection_action ( name , options = { } , &block )
55 if name == :scoped_collection_destroy
6-
7-
8-
96 options [ :title ] = I18n . t ( 'active_admin_scoped_collection_actions.actions.delete' ) if options [ :title ] . nil?
107 add_scoped_collection_action_default_destroy ( options , &block )
118 elsif name == :scoped_collection_update
@@ -18,15 +15,14 @@ def scoped_collection_action(name, options = {}, &block)
1815 config . add_scoped_collection_action ( name , options )
1916 end
2017
21-
2218 def add_scoped_collection_action_default_update ( options , &block )
2319 batch_action :scoped_collection_update , if : proc { false } do
2420 unless authorized? ( :batch_edit , resource_class )
2521 flash [ :error ] = I18n . t ( 'active_admin_scoped_collection_actions.actions.no_permissions_msg' )
26- render nothing : true , status : :no_content and next
22+ head :ok and next
2723 end
2824 if !params . has_key? ( :changes ) || params [ :changes ] . empty?
29- render nothing : true , status : :no_content and next
25+ head :ok and next
3026 end
3127 permitted_changes = params . require ( :changes ) . permit ( *( options [ :form ] . call . keys ) )
3228 if block_given?
@@ -43,17 +39,16 @@ def add_scoped_collection_action_default_update(options, &block)
4339 else
4440 flash [ :error ] = errors . join ( ". " )
4541 end
46- render nothing : true , status : :no_content
42+ head :ok
4743 end
4844 end
4945 end
5046
51-
5247 def add_scoped_collection_action_default_destroy ( _ , &block )
5348 batch_action :scoped_collection_destroy , if : proc { false } do |_ |
5449 unless authorized? ( :batch_destroy , resource_class )
5550 flash [ :error ] = I18n . t ( 'active_admin_scoped_collection_actions.actions.no_permissions_msg' )
56- render nothing : true , status : :no_content and next
51+ head :ok and next
5752 end
5853 if block_given?
5954 instance_eval &block
@@ -69,11 +64,11 @@ def add_scoped_collection_action_default_destroy(_, &block)
6964 else
7065 flash [ :error ] = errors . join ( ". " )
7166 end
72- render nothing : true , status : :no_content
67+ head :ok
7368 end
7469 end
7570 end
7671
77-
7872 end
7973end
74+
0 commit comments