Ruby on Rails Wednesday, December 26, 2018

in erb, something like "<% if comment.body.empty? %> Your error message <% end %>" should sort you... If not, please give further information -- H

On Wed, 26 Dec 2018 at 02:58, jason cao <cg.jieweihui@gmail.com> 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/2abe97f7-2e6b-452b-85d9-a9980d6982fc%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


--
If you wish to request my time, please do so using bit.ly/hd1AppointmentRequest.
Si vous voudrais faire connnaisance, allez a bit.ly/hd1AppointmentRequest.

Sent from my mobile device
Envoye de mon portable

--
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/CAP%2BbYWAbpGUMoXnWsJJLkyqz2fFd5Zf0kL440S2W56GRBK%3DmxQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

No comments:

Post a Comment