Forum: Ruby on Rails is there a "validates_empty" method or a way to do this in a single line?

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
D5df9fcd7ef4c3c937435d7d6adeab2a?d=identicon&s=25 Greg Hauptmann (Guest)
on 2008-11-10 22:32
(Received via mailing list)
Hi,

re Model validations:  is there a "validates_empty" method or a way to
do this in a single line?

tks
134ea397777886d6f0aa992672a50eaa?d=identicon&s=25 Mark Thomas (Guest)
on 2008-11-10 23:07
(Received via mailing list)
Hmm... maybe validates_length_of with max set to 0 (and a custom
message)

Otherwise you may have to write your own validator using a callback
like before_create or before_validation_on_create.

-- Mark.
This topic is locked and can not be replied to.