LoginSignup
2
0

More than 3 years have passed since last update.

rake db:migrate で ArgumentError: Unknown validator: 'UniqunessValidator'

Last updated at Posted at 2020-07-23

sinatraでの開発中、
reke db:migrate
ArgumentError: Unknown validator: 'UniqunessValidator'が出た時の原因と対処

解決策

uniqnessvlidator?そんなの知らないよ!的な事書いているので、
対応してるモデルに、先に書いててたバリデーションを一旦消しました!

user.rb
class User < ActiveRecord::Base
#  validates :email, presence: true, length: {maximum: 255 },
#    format: { with: /\A[\w+\-.]+@[a-z\d\-.]+\.[a-z]+\z/i },
#    uniquness: { case_sensitive: false }
#  has_secure_password
end

これでrake db:migrateを実行で、そしたらマイグレートされました!

よくよく見ると、、、

uniquenessのeが抜けてる!!!

user.rb

    uniquness: { case_sensitive: false }

タイプミスには注意ですね、、、

2
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
2
0