-
-
Save coaxial/7f1a49ceb99578454239b55fa0fa245c to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# controller | |
def create | |
@errors = [] | |
params[:files].each |file| | |
document = Document.new(file:, ...) | |
if document.save | |
# handle success | |
else | |
# ... | |
@errors = document.errors | |
end | |
end | |
redirect_to_or_back root_path | |
end | |
# view | |
%h1= t('.title') | |
= form_with scope: documents, url: my_path do |f| | |
if @errors && @errors.any? | |
- @errors.full_messages.each do |message| | |
%p= message | |
%div.field | |
... |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment