开发者

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.

  • Shailen Tuli


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

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜