Is it possible to keep things DRY and put this into one validation line?
validates_presence_of :login
validates_uniqueness_of :login
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
You actually can just remove the
validates_presence_ofline, becausevalidates_uniqueness_ofdefaults to:allow_blank => false(and:allow_nil => false)Take a look at the docs here .