Support :traits option on implicit association#1552
Support :traits option on implicit association#1552r7kamura wants to merge 1 commit intothoughtbot:mainfrom
:traits option on implicit association#1552Conversation
|
I noticed this PR had been open for some time and took a look at it. Thanks for taking the time to submit it so long ago. I liked the idea of not having to add in the redundant factory declaration just to declare some traits. I hesitated, however, at the idea of adding another special option in addition to the existing With that change, it should be possible to write your example as: user :trait1, :trait2quite similar to how the explicit syntax works: association :user, :trait1, :trait2...and made possible because static attributes were deprecated in As a result, I'm going to close this PR in favor of the other one. Thanks again for the contribution 😎 |
If we want to specify traits in implicit associations, we have to use
:factoryoption. This is not only a naming problem, but also redundant in implicit style, because when using:factoryoption, the main factory name must always be specified, so the same name must be written twice.To resolve this problem, I propose to allow
:traitsoption on implicit associations in this Pull Request.