I use Authlogic for authentication in my Rails project.
It provide default validation for email and login field.
But, I want to allow email to be null for join because my service is for mobile and it is difficult to insert email field in mobile device.
How can I skip email validation with Authlogic in Rails?
class User < ActiveRecord::Base
acts_as_authentic do |c|
c.validate_email_field = false
end
end
I was digging for this one for awhile - extending on what jaehyun said - say you want to skip email validation 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
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With