Skip to content

:context too generic a name to be injected into wrapped objects? #699

Open
@nbfritz

Description

@nbfritz

I am currently working on a project that involved wrapping a set of models with decorators to extend their behavior. I was getting very strange results until I realized that Draper was adding a context getter and setter to my decorator that was interfering with the context variable attribute on my model.

I was able to work around this by explicitly defining a def context; source.context; end getter in my decorator. I fear, though, that this will break Draper in strange ways. Since I'm building a shared gem, I'm also concerned that other implementers of my gem will not know about this potential pitfall. I'm thinking of renaming my attribute, but...man...I loved that name...

Is "context" too generic a term for Draper to use? Or is it a legitimate reserved keyword that I should not be using in my models? Would it be worth prefixing the draper context method to reduce the risk of overlap with wrapped models?

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions