Added condition and validation message for case where user has not attached file.
This commit is contained in:
parent
fa55224163
commit
d8ce1ac967
1 changed files with 3 additions and 1 deletions
|
|
@ -57,7 +57,9 @@ module Admin
|
||||||
def mass_upload
|
def mass_upload
|
||||||
errors = Commercial.read_file(params[:file]) if params[:file]
|
errors = Commercial.read_file(params[:file]) if params[:file]
|
||||||
|
|
||||||
if errors.all? { |_k, v| v.blank? }
|
if errors.nil?
|
||||||
|
flash[:error] = 'No file detected. Please attach a file.'
|
||||||
|
elsif errors.all? { |_k, v| v.blank? }
|
||||||
flash[:notice] = 'Successfully added commercials.'
|
flash[:notice] = 'Successfully added commercials.'
|
||||||
else
|
else
|
||||||
errors_text = ''
|
errors_text = ''
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue