2

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.

  • Shailen Tuli
Shailen Tuli
  • 13,815
  • 5
  • 40
  • 51

1 Answers1

4

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 }.

zetetic
  • 47,184
  • 10
  • 111
  • 119