Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

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

Open
nbfritz opened this issue Oct 13, 2015 · 0 comments
Open

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

nbfritz opened this issue Oct 13, 2015 · 0 comments

Comments

@nbfritz
Copy link

nbfritz commented Oct 13, 2015

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?

@codebycliff codebycliff added this to the 3.0.0 milestone Mar 29, 2017
@Alexander-Senko Alexander-Senko modified the milestones: 3.0, 5.0 Aug 31, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants