-1

I've got the pry gem installed in my rails app and I've been facing with the error when I turn it on:

[1] pry(main)> show-model User
ArgumentError: Unknown validator: 'PrsenceValidator'
from /Users/~/vendor/bundle/ruby/2.5.0/gems/activemodel-5.1.6/lib/active_model/validations/validates.rb:120:in `rescue in block in validates'

On the other hand, such commands as User.all and User.find(1) succcessfully runs to show the information of the table. In addition, as I have several models inside my app, none of which I had success with "show-model Xxx" command, I suppose it's not user model related issue.

My gem file includes the following code:

group :development, :test do
  gem 'pry-rails'
  gem 'pry-doc'
  gem 'pry-byebug'
  gem 'pry-stack_explorer'
  gem 'rails-erd'
end

I've used pry before and this is the first time the pry has reported such an error. I'd appreciate your help. Thank you!

Yosher
  • 643
  • 6
  • 15

1 Answers1

0

Typo error in your model user.rb, prsence is wrong

It should be like

validates :name, presence: true
Ravi Mariya
  • 1,210
  • 15
  • 19
  • As far as I see there are no typos in the user.rb file... I have also commented out all the codes in the user.rb file to run show-model User command, but the result remains to be tha same. – Yosher Jul 08 '18 at 10:32
  • Your error says so `ArgumentError: Unknown validator: 'PrsenceValidator'`, can you post user.rb file, and also check other model – Ravi Mariya Jul 08 '18 at 10:40
  • Oh I've found the typo in other model and I happened to type "prsence"...Now the issue has been fixed. Thank you for your help! – Yosher Jul 08 '18 at 10:50