Skip to content

Commit

Permalink
Add error msg for null file while Adding Commercial for event
Browse files Browse the repository at this point in the history
Null file error message added for uploading empty file in CommercialsController#mass_upload

Closes #1959
  • Loading branch information
AnkushMalik committed Feb 13, 2018
1 parent 8e91f51 commit 0cb5d2c
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion app/controllers/admin/commercials_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,9 @@ def render_commercial
def mass_upload
errors = Commercial.read_file(params[:file]) if params[:file]

if errors.all? { |_k, v| v.blank? }
if !params[:file]
flash[:error] = 'Empty file detected while adding commercials to Event'
elsif errors.all? { |_k, v| v.blank? }
flash[:notice] = 'Successfully added commercials.'
else
errors_text = ''
Expand Down

0 comments on commit 0cb5d2c

Please sign in to comment.