Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix comment saving #62

Merged
merged 2 commits into from Sep 18, 2019
Merged

fix comment saving #62

merged 2 commits into from Sep 18, 2019

Conversation

ulizko
Copy link
Contributor

@ulizko ulizko commented Sep 18, 2019

PR исправляет проблему #54

if comment.save
f(:success)
else
f(:error, errors: comment.errors.full_messages.join(', '))
Copy link
Member

@mokevnin mokevnin Sep 18, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

У флеша есть переводы. Флеш это не та штука, которая выводит ошибки валидации. Ошибки валидации выведутся в форме.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ошибки валидации в форме не выведутся, так как коммент инициализируется прямо в форме @resume.comments.build и рендер резюме, при ошибке валидации, из контроллера комментов влечет за собой усложнение кода

Для простоты кода, может добавить атрибут minlength для textarea и валидировать на клиенте?
Или использовать remote форму для создания комментов?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Нужно сделать так же как сейчас это сделано с answer. Посмотри туда, попробуй по вводи неверные данные.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Сделал по аналогии с answer

@mokevnin mokevnin merged commit 40de717 into Hexlet:master Sep 18, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants