How can I skip email authentication with Authlogic in Rails?

I use Authlogic for authentication in my Rails project.

It provides default validation for email and login fields.

But I want to allow e-mail to be null for the connection, because my service is designed for mobile devices, and it is difficult to insert an e-mail field into a mobile device.

How can I skip email verification with Authlogic in Rails?

+4
source share
2 answers
class User < ActiveRecord::Base acts_as_authentic do |c| c.validate_email_field = false end end 
+7
source

I delved into this question for a long time - while continuing to talk about what jaehyun said - say that you want to skip email authentication in Authlogic on a conditional basis.

  acts_as_authentic do |c| c.merge_validates_length_of_email_field_options({:unless => Proc.new { |user| user.has_no_email? }}) c.merge_validates_format_of_email_field_options({:unless => Proc.new { |user| user.has_no_email? }}) end 
+2
source

All Articles