Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Cannot use decorator methods in decorator #107

Open
wenbo opened this issue May 18, 2020 · 2 comments
Open

Cannot use decorator methods in decorator #107

wenbo opened this issue May 18, 2020 · 2 comments

Comments

@wenbo
Copy link

wenbo commented May 18, 2020

It's okay to use decorator methods in actionview,
but just like the following case, if I use decorator method in other decorator, it will be confronted with error.

it will be wonderful if it's possible to use decorator methods in decorator. that's the feature that needed in my situation.
Any ideas please.

module ClassADecorator
  def mtd_a
    "this is mtd a"
  end
end

module ClassBDecorator
  def mtd_b
    # error, undefined method `mtd_a' for #<ClassA>
    ClassA.new.mtd_a 
  end
end
@vendethiel
Copy link

The readme mentions:

ActiveDecorator::Decorator.instance.decorate(ClassA.new).mtd_a

@wenbo
Copy link
Author

wenbo commented May 18, 2020

@vendethiel

thanks for your reply.
just because there are so many ClassA.new.mtd_a, so what I need is without decorate manually, it's able to use decorator methods in decorator by default.

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants