How to find the cause of the Ruby error

Preface

I tried to explain how to quickly check the error sentences that often appear without translating them!

(ArgumentError) Argument error

When you get this error, you literally get an error about the arguments. For example, it may appear when the number of arguments is incorrect or the value is incorrect.

Suppose you get the following error statement.

Describe a part


arguments(given 2, expected 0)

Translated, Arguments (given 2, expected 0) In an extreme case, the argument passed is 2. Since the receiving side has no arguments, an error occurs.

It will be like. (ArgumentError) If you get this, look for (given, expected)!

(NameError) NameError

Name error. It appears when there is a mistake in the variable name or method name. The name when defined may be incorrect, or the name when calling the method may be incorrect.

Describe a part


undefined local variable or method  '〇〇' 

Translated, Undefined local variable or method Let's pay attention to the variable or method of 〇〇!

did you mean? (Maybe) There are many cases where they are proposing, so check here as well!

(NoMethodError) No Method Error

Error related to method. This happens when the method you are trying to execute has the wrong name when you call it, or when the method has the wrong name when it is defined.

Describe a part


test.rb:2in '〇〇'

This tells you where the error is, so let's check the method in this part!

Check if there is the following description in the no method error! did you mean? (Maybe)

Summary

If you get an error sentence for the time being, let's translate it. I think that there is a part that can be seen if the meaning is understood.

You may find a solution by googled the meaning that came out!

When you get an error, you have a chance to grow. I will do my best to make you think!

Recommended Posts

How to find the cause of the Ruby error
[Ruby] How to find the sum of each digit
How to find the average angle
[Ruby] Meaning of &. How to avoid the error when the receiver (object) is nil
[Ruby on Rails] How to Japaneseize the error message of Form object (ActiveModel)
[Ruby] How to retrieve the contents of a double hash
How to put out the error bundling
How to determine the number of parallels
How to sort the List of SelectItem
How to find the tens and ones
[Ruby on Rails] How to display error messages
Customize how to divide the contents of Recyclerview
The story of introducing Ajax communication to ruby
How to get today's day of the week
Output of how to use the slice method
[Ruby] Code to display the day of the week
How to find out the Java version of a compiled class file
How to find the total number of pages when paging in Java
Iterative processing of Ruby using each method (find the sum from 1 to 10)
How to solve the local environment construction of Ruby on Rails (MAC)!
How to display the result of form input
How to find the total score and average score
How to build the simplest blockchain in Ruby
[Java] How to get the authority of the folder
[Ruby On Rails] How to search the contents of params using include?
[Ruby basics] How to use the slice method
[Ruby on Rails] How to make the link destination part of the specified id
[Ruby on Rails] Rails tutorial Chapter 14 Summary of how to implement the status feed
[Java] How to get the URL of the transition source
How to delete / update the list field of OneToMany
How to write Scala from the perspective of Java
[Ruby on Rails] How to change the column name
How to install the root certificate of Centos7 (Cybertrust)
[Java] How to get the maximum value of HashMap
[Rails] How to change the column name of the table
[SwiftUI] How to specify the abbreviated position of Text
[Android] How to get the setting language of the terminal
[Rails] How to get the contents of strong parameters
How to judge the click of any area of the image
How to download the old version of Apache Tomcat
[Ruby] How to get the tens place and the ones place
[Swift] How to get the document ID of Firebase
How to resolve SSL_connect error in PayPal Ruby SDK
How to use Ruby return
[Ruby] How to comment out
[Ruby] Introduction to Ruby Error statement
Ruby: How to use cookies
[Ruby] How to write blocks
How to find the total value, average value, etc. of a two-dimensional array (multidimensional array)-java
Offline real-time how to write Implementation example of the problem in E05 (ruby, C11)
How to request by passing an array to the query with HTTP Client of Ruby
[ruby] How to assign a value to a hash by referring to the value and key of another hash
How to display the select field of time_select every 30 minutes
Difference between Java and JavaScript (how to find the average)
[Ruby] Find a permutation consisting of 0 to 9 at high speed.
Comparison of how to write Callback function (Java, JavaScript, Ruby)
How to retrieve the hash value in an array in Ruby
How to get the longest information from Twitter as of 12/12/2016
How to change the setting value of Springboot Hikari CP
I tried to summarize the basic grammar of Ruby briefly
How to add elements without specifying the length of the array