Search code examples
rubymoduleirbarticle

Ruby on Rails undefined local variable or method in console


What is problem? I don't understand.

enter image description here


Solution

  • There are 2 things that could be happening. First, you meant to list Article.all, referencing the class. Second, you're referencing article.all as a array, in which case it hasn't been defined as such in your code.

    Also, please don't post images of code. Just copy/paste and use the code formatting tools. It really helps us understand what is going on.

    Also, it helps to give as much background as possible, meaning what the code is supposed to do, why you're doing it, etc. The more thorough you are, the more helpful we can be.