我开始学习Rails,但我无法继续学习,因为我在尝试运行时遇到了一个错误:
bundle exec rspec spec/
我认为错误出现在我的“models/users.rb”文件中:
class User < ActiveRecord::Base
attr_accessible :email, :name
before_save { |user| user.email = email.downcase }
validates :name, presence: true, length: { maximum: 50}
VALID_EMAIL_REGEX = /\A[\w+\-.]+@[a-z\d\-.]+\.[a-z]+\z/i
validates :email, presence: true, format: {with: VALID_EMAIL_REGEX },
uniquiness: { case_sensitive: false }
end
在此之前,我做错了一件事:我应该在哪里打字
uniquiness: { case_sensitive: false }
我键入了:
uniquiness { case_sensitive: false }
而且,在我看到这个错误之前,我在我的项目中做了一些更改(创建了一个迁移,运行本地服务器等)。我记得我执行了以下命令:
bundle exec rake db:migrate
bundle exec rake db:test:prepare
bundle exec rspec /spec
以下是我得到的错误:
Rack::File headers参数在Rack 1.5之后替换cache_control。
/usr/lib/ruby/gems/1.9.1/gems/activemodel-3.2.12/lib/active_model/validations/validations.rb:96:在“验证中的块中的救援”中:未知验证程序:“UniquinessValidator”(ArgumentError)
(...)
有人能帮我吗?谢谢大家:P