diff --git a/app/controllers/words_controller.rb b/app/controllers/words_controller.rb index bb6959a..03f5463 100644 --- a/app/controllers/words_controller.rb +++ b/app/controllers/words_controller.rb @@ -14,7 +14,13 @@ class WordsController < ApplicationController end def create - raw = params[:word_list].to_s.strip + raw = params[:word_list].to_s.strip + + if params[:word_file].present? + file_content = params[:word_file].read.force_encoding("UTF-8") + raw = "#{raw}\n#{file_content}".strip + end + lines = raw.split("\n").map(&:strip).reject { |l| l.blank? || l.start_with?("#") } imported = 0