Skip to content

Conversation

joel
Copy link
Collaborator

@joel joel commented Oct 5, 2016

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 #74

Right now I can't upgrade to the 4.2.7

@drakmail
Copy link
Collaborator

drakmail commented Nov 6, 2016

Really seems that counter_cache methods is broken, I'll try to take a look on this issue at this week

@IngusSkaistkalns
Copy link

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.

@flanger001
Copy link

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants