ActiveRecord::RecordNotFound in CommentsController#create

am getting this error this errour ActiveRecord::RecordNotFound in CommentsController#create

here is my comments controller

You’re looking for an article that doesn’t exist :slight_smile:

From the documentation:

“If one or more records can not be found for the requested ids, then RecordNotFound will be raised.”

Fix:

Either check if the record exists or rescue the exception.

i have the article i don’t know why its giving me that error thanks

this is my repository

Questions:

  • What is the value of params[:article_id] on line 4?

  • What is the output of Article.all?

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs