Rails adds the handy method blank?
which checks for false, nil and empty strings as described here.
Rails also adds the handy validator allow_blank: false
.
So in your case it should be:
validates :body, presence: true, allow_blank: false
Edit (original answer above):
As stated in the answer below, allow_blank: false
is not needed as that’s the default behaviour of presence: true
.