Ruby: "nomethoderror: private method `x` called" issue

Example:

class Example
  private
  def a_private_method
  end
end
Example.new.a_private_method
This error is raised when you try to call a private method directly.

Solution:

# Ensure you are not directly calling a private method. Instead, use a public method to access it.

Beginner's Guide to Ruby