Kvass
Kvass

Reputation: 8434

Rails -- validations

I know that the validates method can validate presence, length, format, uniqueness, and confirmation. However, sometimes I see people just setting these values to true/false, while other times they are more specific and pass in a hash that specifies the exact constraints (e.g. :maximum => 50 for length or case_sensitive => false for uniqueness). Is there a way that I can view a list of all the specifications that can be added to each of these validation tests?

Upvotes: 0

Views: 182

Answers (1)

Matthew Lehner
Matthew Lehner

Reputation: 4027

This is right in the Rails API for ActiveModel::Validations::HelperMethods.

A list of validators and their respective options can be found here: http://api.rubyonrails.org/classes/ActiveModel/Validations/HelperMethods.html

Upvotes: 1

Related Questions