Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix reflection cache #90

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

Fix reflection cache #90

wants to merge 1 commit into from

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