Unknown validator: 'InValidator' on Ruby on Rails

Viewed 1371

I am following the official getting started guide of Ruby on Rails. The guide provides the following code to add status validation to the concern:

module Visible
  extend ActiveSupport::Concern

  included do
    VALID_STATUSES = ['public', 'private', 'archived']

    validates :status, in: VALID_STATUSES
  end

  def archived?
    status == 'archived'
  end
end

However I get the following error: Unknown validator: 'InValidator' on line validates :status, in: VALID_STATUSES. I am using Rails 6.1.0 and following the guide for this version exactly. What is the problem here?

Edit
I have done a small change to make it work: validates :status, inclusion: { in: VALID_STATUSES }. But I want to know why in is not working as in the guide.

1 Answers
Related