File tree Expand file tree Collapse file tree 1 file changed +3
-4
lines changed
Expand file tree Collapse file tree 1 file changed +3
-4
lines changed Original file line number Diff line number Diff line change @@ -33,13 +33,12 @@ def active_admin_import options = {}, &block
3333 headers_rewrites : { }
3434 }
3535 options = default_options . deep_merge ( options )
36- options [ :template_object ] = ActiveAdminImport ::Model . new if options [ :template_object ] . blank?
37- params_key = ActiveModel ::Naming . param_key ( options [ :template_object ] )
36+ params_key = ActiveModel ::Naming . param_key ( options [ :template_object ] || ActiveAdminImport ::Model . new )
3837
3938 collection_action :import , method : :get do
4039 authorize! ( ActiveAdminImport ::Auth ::IMPORT , active_admin_config . resource_class )
4140
42- @active_admin_import_model = options [ :template_object ]
41+ @active_admin_import_model = options [ :template_object ] || ActiveAdminImport :: Model . new
4342 render template : options [ :template ]
4443 end
4544
@@ -52,7 +51,7 @@ def active_admin_import options = {}, &block
5251 collection_action :do_import , method : :post do
5352 authorize! ( ActiveAdminImport ::Auth ::IMPORT , active_admin_config . resource_class )
5453
55- @active_admin_import_model = options [ :template_object ]
54+ @active_admin_import_model = options [ :template_object ] || ActiveAdminImport :: Model . new
5655 @active_admin_import_model . assign_attributes ( params [ params_key ] . try ( :deep_symbolize_keys ) || { } )
5756 #go back to form
5857 return render template : options [ :template ] unless @active_admin_import_model . valid?
You can’t perform that action at this time.
0 commit comments