Quantcast
Channel: Ruby NoMethodError - Stack Overflow
Viewing all articles
Browse latest Browse all 3

Ruby NoMethodError

$
0
0

Ok, I'm a bit of a newb. I know this error is occuring because I don't properly understand something about how methods are called. So can you help me understand what is going wrong here?

NoMethodError in ThingController#indexundefined method `initialized?' for Thing::Backend:Class

From the erroring section of ThingController.rb:

class ThingController  def init_things   Backend.init_things unless Backend.initialized?      end  t = ThingController.new   t.init_thingsend

inside Backend.rb

class Backend  # checks if the things hash is initialized  def initialized?    @initialized ||= false  end  # loads things  def init_things    puts "I've loaded a bunch of files into a hash"    @initialized = true  endend

I'm not calling the method correctly and I cannot find any clear explanations for this error on the internet. Please help.

Thanks


Viewing all articles
Browse latest Browse all 3

Latest Images

Trending Articles





Latest Images