Read more

Deal with error: Expected foo_trait.rb to define FooTrait

Dominik Schöler
June 28, 2012Software engineer at makandra GmbH

Lately, I came across a nasty error. I had a class Article that included FooTrait and BarTrait. In BarTrait, I then accidentally called a non-existent method:

has_defaults :dummy => Dummy.non_existent_method
Illustration web development

Do you need DevOps-experts?

Your development team has a full backlog? No time for infrastructure architecture? Our DevOps team is ready to support you!

  • We build reliable cloud solutions with Infrastructure as code
  • We are experts in security, Linux and databases
  • We support your dev team to perform
Read more Show archive.org snapshot

From that moment, no page would load anymore but always display an exception: Expected foo_trait.rb to define FooTrait. That trait had nothing to do with BarTrait.

Since it doesn't tell you what's wrong, you either remember where you were working last or you need to check all traits Show archive.org snapshot for mistakes.

This behavior is likely to be caused by Rails' autoloading.

Posted by Dominik Schöler to makandra dev (2012-06-28 09:56)