我正在尝试设置我的应用程序以使用 Sorcery。当我添加authenticates_with_sorcery!到我的用户模型时,我的规范开始运行非常慢(大约每秒一个)。是否有某种配置或设置可能导致巫术出现这种情况?
这是我的用户模型:
# This model represents a user of the application, disregarding that person's use of the system. For
# instance, a user could be a job hunter, an employer, an administrator, or some other stakeholder.
class User < ActiveRecord::Base
  authenticates_with_sorcery!
  attr_accessible :email, :password, :password_confirmation
  # validations
  validates :email, 
            :presence => true, 
            :uniqueness => true, 
            :format => /[^@]+@[^@]+\.[^@]+/
  validates :password, :presence => true, :confirmation => true
  validates :password_confirmation, :presence => true
  # before filters
  before_save :sanitize_email
  private
  # Strips and removes HTML tags from the email parameter.
  def sanitize_email
    self.email = email.strip
    # remove anything that looks like an email
    self.email = email.gsub(/<[^<>]+>/, "")
  end
end
和我的用户工厂:
require 'factory_girl'
require 'ffaker'
FactoryGirl.define do
  sequence :email do |n|
    "email#{n}@example.com"
  end
  factory :user do |f|
    email
    password "password"
    password_confirmation "password"
  end
end