Skip to content
This repository has been archived by the owner on Jul 13, 2023. It is now read-only.

Fix 293, 601: STI subclassing overwrites options #605

Merged
merged 1 commit into from
Oct 21, 2011
Merged

Fix 293, 601: STI subclassing overwrites options #605

merged 1 commit into from
Oct 21, 2011

Conversation

ramn
Copy link
Contributor

@ramn ramn commented Sep 25, 2011

Problem: When using STI, and when 'config.cache_classes = true', then
the STI subclass that gets loaded last will overwrite the options for
the others. This is due to using Rails class_attribute with a mutable
hash.

Solution: dup the hash.

Related issues: #293, #601

Problem: When using STI, and when 'config.cache_classes = true', then
the STI subclass that gets loaded last will overwrite the options for
the others. This is due to using Rails class_attribute with a mutable
hash.

Solution: dup the hash.
@JaredSartin
Copy link

Looks good. Lets get it added.

@TobiasWallin
Copy link

+1

@mike-burns
Copy link
Contributor

Closing in a week unless someone contributes a test.

Thanks,
-Mike

@ramn
Copy link
Contributor Author

ramn commented Oct 7, 2011

The problem appears when using Single Table Inheritance and 'config.cache_classes = true'. Does anyone have a suggestion how to test this?

@sikachu
Copy link
Contributor

sikachu commented Oct 21, 2011

I would say this is quite tricky to test, and there's already someone confirming the fix in #601. So I'm merging this in.

sikachu added a commit that referenced this pull request Oct 21, 2011
Fix 293, 601: STI subclassing overwrites options
@sikachu sikachu merged commit 35b91fb into thoughtbot:master Oct 21, 2011
@atd
Copy link

atd commented Jan 12, 2012

Hi, is there any reason stopping this fix for being released? This pull request was accepted the same day the last version was released, but just after that... 3 months ago!

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

6 participants