amatsuda/active_decorator

How Decorate Namespaced Models?

Closed this issue · 1 comments

Model:

class Promoter
  class Role < ApplicationRecord
  end
end

Decorator:

class Promoter
  class RoleDecorator
    def _permissions; end
  end
end

Error:

NoMethodError:
    undefined method `_permissions' for #<Promoter::Role id: nil, ...

@wbotelhos Promoter::RoleDecorator has to be a module, not a class, so it can be mixed in to Role class.
Also, there used to be a bug that nested class decoration was not working until dbc85d3 (gem version 1.3.1). So please make sure you're bundling a newer version of this gem.