This error usually happens when we try to access a method of a NilClass. Let say we have a post object like: below:
post = {id: 2}Now we are trying to access a property called title in the post object like below:
post[:title] #which is nilNow if we are trying to access a method like below then we will get the error NoMethodError: undefined method for nil
post[:title].repliesDetails on Ruby NilClass can be found in this link
Comments
Post a Comment