trailblazer-loader
trailblazer-loader copied to clipboard
Representers not properly autoloaded using trailblazer
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.