feat: handle word_file upload in create action
Some checks failed
CI / Lint & Test (push) Has been cancelled
Deploy Status Page / Build & Deploy (push) Has been cancelled

This commit is contained in:
viktorvsk 2026-04-23 04:51:47 +00:00
parent e9f5d8ece2
commit 3992ba64be

View File

@ -15,6 +15,12 @@ class WordsController < ApplicationController
def create
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