0
我使用此宝石验证了模型中的电子邮件https://github.com/validates-email-format-of/validates_email_format_of 如何跳过此验证检查,因为这会导致速度变慢。如何在Rails中跳过某些模型验证以加速单元测试
我使用此宝石验证了模型中的电子邮件https://github.com/validates-email-format-of/validates_email_format_of 如何跳过此验证检查,因为这会导致速度变慢。如何在Rails中跳过某些模型验证以加速单元测试
为验证添加一个条件,因为gem有该选项。所以
validates_email_format_of :email, :message => 'is not looking good', unless: "Rails.env.test?"