trailblazer-loader icon indicating copy to clipboard operation
trailblazer-loader copied to clipboard

Representers not properly autoloaded using trailblazer

Open HoneyryderChuck opened this issue 7 years ago • 0 comments

I'm defining representers in the nested-plural way. So I have the following representer:

# app/concepts/users/representer/user_representer.rb
class UserRepresenter < Representable::Decorator
  property :name
  collection :tax_residencies, decorator: TaxResidencyRepresenter
end

# app/concepts/tax_residencies/representer/tax_residency_representer.rb
class TaxResidencyRepresenter < Representable::Decorator
...
end

When I try to run any of my rails-defined tasks, for db or running specs, I get this error:


 uninitialized constant UserRepresenter::TaxResidencyRepresenter

my "quick-fix" was to add the following line above the user representer definition:

require_dependency Rails.root.join("app", "concepts", "tax_residencies", "representer", "tax_residency_representer")

but I think this is broken behaviour, indicating a bug in the loader logic.

HoneyryderChuck avatar May 17 '18 13:05 HoneyryderChuck