48
Root
7y

Here's how my day is going:

> Access::MerchantsController
=> MerchantsController
> Access::MerchantsController
NameError: uninitialized constant Access::MerchantsController

-.-

Comments
  • 13
    Face Hidden by Palms Reflection Reveal
  • 6
    Normal people: *zoom to see the face*
    Me: *zoom to look for typos*

    Also, that's what u get for using ruby.
  • 4
    @AlgoRythm-- 😋
  • 1
    what
  • 8
    @tbodt This is a rare issue lovingly titled "autoloader hell" where rails can't immediately resolve an unloaded constant but finds a correctly named path and file with a matching (but incorrect) declaration, and only realizes that the declaration is incorrect on the second lookup.

    Thus the first attempt works (erroneously), and fails on all subsequent references.

    The short: I did something wrong somewhere and confused the poor thing.
  • 6
    @Condor yes and no

    I usually use curl for API testing, plus the usual rails server and rails console (and git) via cli. My primary editor is sublime, not vim, and I still need to use Firefox for frontend since lynx doesn't care about css 😋

    So. 2/3rds cli?
  • 1
    @Root wait, really? o.o
  • 3
    I like that camera hiding thingy
  • 4
    @AlgoRythm Yep. This is why autoloaders are secretly terrible things, even though they feel wonderful and reduce your effort the rest of the time. Everything is great while they work as expected, but as soon as you run into issues, understanding what is happening and why takes a deep understanding of exactly how the autoloader works, which very few people have. Knowing exactly how inheritance works might not help you here, and debugging can be a nightmare... especially when you've never encountered it before.

    If you instead load everything manually through e.g. require, you'll never run into an issue like this (unless you really screw up, ofc)

    It's pretty rare, but it can still happen.

    In this case, I have two MerchantController classes with different parents and an ambiguous reference somewhere. There are other aspects complicating this, but that's the root cause.
  • 2
    Can someone tell us what's that camera thingy please !!!
  • 2
    @rising It's a slider blocking my webcam. Free swag from some convention a friend of a coworker attended.
  • 1
    @Root I'm reminded of gary bernhardt's "wat" talk where he did

    def method_missing(*args); args.join(' '); end
  • 1
    "It's not magic, just look at the source"

    When it works Rails is lovely. When it doesn't debugging is quite doable. But when it breaks deep down inside, you're doomed
  • 2
    @wildebeest Very true. However, Rails itself breaking is fortunately quite rare!
  • 1
    Nice camera's lock
Add Comment