You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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?
The text was updated successfully, but these errors were encountered:
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 thecontext
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?
The text was updated successfully, but these errors were encountered: