Shailen Tuli
Shailen Tuli

Reputation: 14171

Authlogic: turn off uniqueness constraint

We've been happily running Authlogic for our app for a while. Now, however, we would like to turn off the uniqueness constraint on emails when creating users. Is there a simple way to do this?

I was hoping for something like:

acts_as_authentic do |c|  
    c.validate_uniqueness_of_email_field = false # This doesn't work  
end  

What is the exact directive to place within the block to turn off the uniqueness constraint?

Many thanks for your help.

Upvotes: 2

Views: 398

Answers (1)

zetetic
zetetic

Reputation: 47548

This seems to work:

acts_as_authentic do |c|
  c.validates_uniqueness_of_email_field_options :if => lambda { false }
end

Or:

acts_as_authentic do |c|
  c.validates_uniqueness_of_email_field_options :on => []
end

Basically the block is treated as a Rails validator. Unfortunately the value false does not work here, nor does the block { false }.

Upvotes: 4

Related Questions