Commit message (Collapse) | Author | Age | Files | Lines | |
---|---|---|---|---|---|
* | Fix safe_constantize to not raise a LoadError. | Keenan Brock | 2019-01-09 | 1 | -0/+10 |
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | ### Summary There was an issues when using `safe_constantize` on a string that has the wrong case. File `em.rb` defines `EM`. `"Em".safe_constantize` causes a little confusion with the autoloader. The autoloader finds file "em.rb", expecting it to define `Em`, but `Em` is not defined. The autoloader raises a `LoadError`, which is good, But `safe_constantize` is defined to return `nil` when a class is not found. ### Before ``` "Em".safe_constantize LoadError: Unable to autoload constant Em, \ expected rails/activesupport/test/autoloading_fixtures/em.rb to define it ``` ### After ``` "Em".safe_constantize # => nil ``` | ||||
* | [Active Support] `rubocop -a --only Layout/EmptyLineAfterMagicComment` | Koichi ITO | 2017-07-11 | 1 | -0/+1 |
| | |||||
* | Use frozen-string-literal in ActiveSupport | Kir Shatrov | 2017-07-09 | 1 | -0/+1 |
| | |||||
* | Revert "Merge pull request #29540 from kirs/rubocop-frozen-string" | Matthew Draper | 2017-07-02 | 1 | -1/+0 |
| | | | | | This reverts commit 3420a14590c0e6915d8b6c242887f74adb4120f9, reversing changes made to afb66a5a598ce4ac74ad84b125a5abf046dcf5aa. | ||||
* | Enforce frozen string in Rubocop | Kir Shatrov | 2017-07-01 | 1 | -0/+1 |
| | |||||
* | Fix constantize edge case involving prepend, autoloading and name conflicts | Jean Boussier | 2016-12-14 | 1 | -0/+5 |
| | | | | | | | | | | | | | | | | | | | | | | | | | | | In the following situation: ```ruby class Bar end module Baz end class Foo prepend Baz end class Foo::Bar end ``` Running `Inflector.constantize('Foo::Bar')` would blow up with a NameError. What is happening is that `constatize` was written before the introduction of prepend, and wrongly assume that `klass.ancestors.first == klass`. So it uses `klass.ancestors.inject` without arguments, as a result a prepended module is used in place of the actual class. | ||||
* | applies new string literal convention in activesupport/test | Xavier Noria | 2016-08-06 | 1 | -5/+5 |
| | | | | | The current code base is not uniform. After some discussion, we have chosen to go with double quotes by default. | ||||
* | Merge pull request #21250 from ronakjangir47/safe_const | Yves Senn | 2015-09-07 | 1 | -0/+4 |
|\ | | | | | | | safe_constantize - Added Object scoped missing test cases | ||||
| * | safe_constantize - Added Object scoped missing test cases | Ronak Jangir | 2015-09-06 | 1 | -0/+2 |
|/ | |||||
* | Use `safe_constantize`. | Guo Xiang Tan | 2014-09-02 | 1 | -0/+30 |
| | | | | Fixes https://github.com/rails/rails/issues/9933. | ||||
* | Add Missing Test Cases for the constantize | Aditya Kapoor | 2014-06-07 | 1 | -0/+11 |
| | |||||
* | Fix #10932. Treat "" and "::" as invalid on constantize | Nikolay Shebanov | 2013-06-14 | 1 | -4/+4 |
| | |||||
* | cleaning up constantize tests | Aaron Patterson | 2012-11-07 | 1 | -44/+44 |
| | |||||
* | Handle case where ancestor is not the end of the chain | Andrew White | 2012-05-19 | 1 | -0/+2 |
| | |||||
* | Fix constantize so top level constants are looked up properly. | Marc-Andre Lafortune | 2012-05-19 | 1 | -0/+18 |
| | |||||
* | Make constantize look down the ancestor chain (excluding Object) | Marc-Andre Lafortune | 2012-05-19 | 1 | -0/+17 |
| | |||||
* | safe_constantize should handle wrong constant name NameErrors Fixes #4710 | Alex Tambellini | 2012-01-26 | 1 | -2/+3 |
| | |||||
* | Ensure that constantize just rescues NameError that applies to the constant ↵ | José Valim | 2011-09-23 | 1 | -0/+6 |
| | | | | being currently loaded. | ||||
* | Added ActiveSupport::Inflector.safe_constantize and String#safe_constantize; ↵ | Ryan Oblak | 2011-09-23 | 1 | -0/+31 |
refactored common constantize tests into ConstantizeTestCases |