This project is archived and is in readonly mode.
Model classes are loaded before I18n is set when running tests.
-
Franco Catena
- Tag changed from testing environment, eager_loading, i18n, rails3, test to eager_loading, i18n, rails3
I have the same problem, the i18n configuration is not loaded consistently across environmets. I create a patch that fix this, is for the master branch, but can be easily implemented in the other 3.X branches (only 3 lines of code).
I hope this helps anyone with the same problem.
Regards.
-
Franco Catena
- Tag changed from eager_loading, i18n, rails3 to testing environment, eager_loading, i18n, rails3
Sorry, I accidentally delete the testing environment tag.
-
Robert Pankowecki
It is nice to have a fix and it would be even better to have a test for this so it will not change accidentally in the future.
-
Franco Catena
Yes, I am working on the tests and an improvement of this patch, because only works when you have cache_classes = true (I just notice that, so is better avoid using it for now).
-
Robert Pankowecki
Thanks for your time and paying attention to this bug. I really appreciate that.
-
Franco Catena
OK, there I go again.
-
Short version: the patch fix this issue
-
Long version: the configuration of the i18n railtie was in the after_initialize callback of the Rails configuration hooks, they are called after the classes eager load proccess. In the current schema of callbacks this can not be fixed, so I add the after_configuration method to the Rails configuration hooks (just when finisher starts). I make 2 new tests in the i18n initializer tests for this and include the new hook in the hook's tests.
Is a messy explanation, I know =).
Regards.
-
-
Robert Pankowecki
I wish I could test it but master branch is failing due to "Rack::Session::Abstract::SessionHash" when running
rails console. -
Robert Pankowecki
- Tag changed from testing environment, eager_loading, i18n, rails3 to testing environment, eager_loading, i18n, patch, rails3
-
Franco Catena
Robert, I make one patch for the 3.0 stable branch (because this must be fixed in 3.0 too), I hope you can try this.
-
Robert Pankowecki
I checked the patch for 3.0-stable and it works ok for the case described in this ticket.
Thank you! -
Robert Pankowecki
- Tag changed from testing environment, eager_loading, i18n, patch, rails3 to testing environment, cache_classes, eager_loading, i18n, patch, rails3
-
lewy313
I checked that patch today at work, and it works for me ;)
-
Franco Catena
- Tag changed from testing environment, cache_classes, eager_loading, i18n, patch, rails3 to testing environment, cache_classes, eager_loading, i18n, patch, rails3, railties, verified
OK, thank you for the confirmations, I will update the tags to add verified and railties.
-
Franco Catena
- Tag changed from testing environment, cache_classes, eager_loading, i18n, patch, rails3, railties, verified to testing environment, cache_classes, eager_loading, i18n, patch, rails3, railties
Ops I don't read well, It sais 3 people, tag verified removed
-
Miłosz Jerkiewicz
The patch works for me too.
-
Franco Catena
- Tag changed from testing environment, cache_classes, eager_loading, i18n, patch, rails3, railties to testing environment, cache_classes, eager_loading, i18n, patch, rails3, railties, verified
-
tbh
Is #6353 I18n load path needs to be setup before eager loading about the same issue as this ticket? In case one wants to coordinate the patches...
-
José Valim
- State changed from new to duplicate
- Importance changed from to Low
-
Franco Catena
It is a shame, I do not know what is wrong with this path, why the one in #6353 I18n load path needs to be setup before eager loading was accepted and this is not.
-
José Valim
Sorry Franco, but it was not intentional. Somehow, #6353 I18n load path needs to be setup before eager loading found his way to a Rails Core first. :( I just got to know about this one after someone dropped a comment on #6353 I18n load path needs to be setup before eager loading.
-
Franco Catena
OK José, no problem, thank you for you concern.
