Fix stack exception when calling translates multiple times#50
Open
odarriba wants to merge 9 commits intoLeadformance:masterfrom
Open
Fix stack exception when calling translates multiple times#50odarriba wants to merge 9 commits intoLeadformance:masterfrom
translates multiple times#50odarriba wants to merge 9 commits intoLeadformance:masterfrom
Conversation
added 7 commits
March 17, 2016 11:45
…late into Leadformance-master
Author
|
ping @lminaudier ? I think that this is a huge improvement, because using Also, Test has been fixed to avoid crashing in 1.9.3. |
Author
|
ping @robworley ? :) |
Contributor
|
Hi @odarriba, First; thanks for the report and the PR. Then, by any chance could you add some specs ? |
Author
|
@lminaudier there you go! I've added specs to test that a model that have called Hope this helps :) Thanks for the reply! |
Author
|
Any news on this? |
Author
|
@lminaudier any news? Is there any chance to maintain and improve this gem? |
Contributor
|
I couldn't reproduce (and apparently the test provided doesn't fail either without your fix). Could you please try again? |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
In a project I'm working on, I have this models:
As you can see, I'm using Single Table Inheritance to store different kind of Objects in the same table. As I want to translate both fields, I have to call
translatesmethod two times (I could call it only once inObjectclass, but:wadusfield it's supposed to be only unTablemodel).This causes an
alias_methodloop that ends in anStack level too deepexception. To fix it, I've create a patch that verifies if the model already has translated attributes, in which case avoids creating the aliases, so this loop never happens.And thanks for your work in this gem, it's awesome!