Ruby on Rails Wednesday, December 26, 2018

if @object.errors.any?

On Wednesday, December 26, 2018 at 5:58:32 AM UTC-5, jason cao wrote:
Hi,

How can I show error messages if a comment is invalid? E.g. when a comment body is empty. I add validation in the model class, and the validation itself works, but it won't show any error message. Can you please help? Many thanks!

Regards,
Jason

--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscribe@googlegroups.com.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/22f1eb0d-6af1-440a-8aff-e4c539bf1a37%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

No comments:

Post a Comment