Validation Example Wrong

class Person < ApplicationRecord validates :name, presence: true end

p = Person.new

=> #<Person id: nil, name: nil>

p.errors.messages THIS IS WRONG

=> {} THIS IS WRONG

p.valid?

=> false

p.errors.messages

=> {name:[“can’t be blank”]}

Hi Bala, its working as expected. Until you call `valid?` or `save`, no validations are run, and errors hash would be blank. What would be the expected the output to be here, for you?

Thanks, Vipul A.M. +91-8149-204995