Open joel opened 8 years ago
Really seems that counter_cache methods is broken, I'll try to take a look on this issue at this week
I have not checked if its true, but this would also fix HABTM issues, because _reflections
includes HABTM association that gets generated dynamically, while this assoc does not appear when reflect on records class.
class Article
has_and_belongs_to_many :article_classes
end
Article.new._reflections['article_article_classes'] # => ActiveRecord::Reflection::HasManyReflection: @name=:articles_article_classes
Next this will happen => https://github.com/JackDanger/permanent_records/blob/master/lib/permanent_records.rb#L110, and so we get undefined method articles_article_classes
called.
I realize I'm awakening what may be a dead thread here, but this is something I'm finding also and changing _reflections
to PermanentRecords.dependent_permanent_reflections(self.class)
works for me as well.
I've a trouble with using attribute accessor _reflections this bring to me wrong associations, and it fixed when I use directly the method reflections but test suite break, maybe @drakmail can have a look, you made this PR https://github.com/JackDanger/permanent_records/pull/74
Right now I can't upgrade to the 4.2.7