[Note] Rails error list


I will summarize the error sentences that I have encountered while doing the tasks so far. However, I think the solution is on a case-by-case basis, so it might be a good idea to think of such an error statement as follows ... It's just a memorandum.

Error statement list

Name Error エラー1.png

(Example 1) Name Error in Books#index undefind local variable or method 'book' Did you mead? @book @book ↓ The local variable method book is not defined. Isn't it @book or @books? ** => Possible ** There are many misspellings. Let's take a look at the page pointed out again.

(Example 2) Name Error in Books#index uninitialized constant user::Relationship 24 passive-relationships.find-by(following_id:user_id).oresent? ↓ Uninitialized constant user :: Relationship (= Unable to read the defined class) ** => Possible ** Again, this is often a misspelling. Let's take a look at model, view and controller.

No Method Error


(Example) No Method Error in Books#create undefind method 'user' for nil :nilclass ↓ Method error (undefined method called) A method called'user is not defined. ** => Possible ** ① in Books # create → user column is not added to the Books table 2 If there is Did you mean ?, rewrite it. By the way,'each', which does not specify columns, often appeared in this error statement (I forgot to solve it).


(Example 1) Action Controller::Unknown Format in Homescontroller#top ↓ Missing view file error for action ** => Possible ** You may not have created a view file.

(Example 2) Action COntroller::Url Generation Error in Member::Addresses#index No route matches {action=> "edit" :controller=>"member/addresses#index" id=>nil} missing required keys:[id] ↓ Since there is no id in the part specified by edit, it could not be matched and URL generation failed. ** => Possible ** You may not have specified an id in the controller edit.


(Example) Template is missing controller render:show ↓ There is no template. ** => Possible ** The view of the action set in the controller may not be set.


(Example) ArgumentError in Books#index first argument in form cannot contain nil or be empty ↓ Argument error The first argument of the form cannot contain nil or be empty. ** => Possible ** For example, it happens when updating by leaving the name of the logged-in user who must enter a value blank on the edit screen. Therefore, it may be solved by (1) outputting an error message when updating with a blank, and (2) writing validation.


(Example) Load Error in Usercontroller#show unable to autoload constant Relationship ↓ Load error Unable to autoload constant Relationships. ** => Possible ** In my case, the model Relationship was spelled incorrectly in the follow function.

It is like this. I will update it when it increases again.

Recommended Posts

[Note] Rails error list
Rails Credentials Note
Catch Rails Routing Error
[Rails error] unexpected tIDENTIFIER
Mac Rails Install Error
rails heroku error log
rails error resolution summary
[Note] Rails3 routing confirmation
[Rails 6] Rubocop warning list
rails error Library not loaded
docker-compose command list (for Rails)
Error in rails db: migrate
[Rails] Rails version upgrade error memorandum
Error when using rails capybara
[rails] error during devise installation
[Note] Error message when using Rails Form object pattern Japanese
[Rails] What was the error message?
[Rails] Japanese localization of error messages
[Rails] How to use devise (Note)
[Rails] List instances of multiple models
[Rails] About the Punk List function
[Rails] Unexpected validation error in devise
[Personal note] Rails DB index consideration
[Rails] Display form error messages asynchronously
Japanese localization of error messages (rails)
[Rails] syntax error, unexpected tSTRING_END, expecting'''
[Rails] AWS deployment error encounter summary
Rails tutorial Resolved an error deploying to Heroku, so note the solution
[rails] List of actions defined in Controller
[Rails] How to display error messages individually
Testing for Error Messages: Rails Tutorial Notes-Chapter 7
[Ruby / Rails] Mechanism for retrying Thread Error
[rails s error] md5.bundle and mysql installation error
[Note] How to use Rails 6 Devise + cancancan
rails test fails with database reference error
Rails console Incorrect string value error handling
Let's make an error screen with Rails
[Rails / Heroku] Error resolution procedure after push