Comma uses wrong comma block on single table inheritance in Rails
chrisdb opened this issue · 7 comments
If a comma block is defined on a super class, but missing in one sub class, the comma block from a wrong subclass is used, instead of the one from the super class.
This behaviour only occurs in a Rails / Active Record environment and is not a general inheritance problem.
To reproduce, execute the tests I added in this commit:
chrisdb@508c159
Any chance to get this fixed?
Fixed and released version 3.2.3.
Thank you for reporting and specs.
Thanks for fixing!
Hmm - sorry to bother but the fix breaks existing code for me.
We have three classes: Customer, which is the parent, Buyer and Seller. Buyer and Seller inherit from Customer. Within Customer we define two comma blocks, one without scope and one with scope :newsletter. Before the patch I could call some_sellers_list.to_comma(style: :newsletter)
and that would in turn call the parent class implementation. Now I get an error No comma format for class Seller defined for style newsletter
- This is something the specs from @chrisdb did not cover...
@bvogel can you try eitoball@36eabb5 and check if spec in this change cover your case?
Released version 3.2.4. Thx for reporting.