开发者

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. 开发者_JAVA百科: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?


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

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜