-
Notifications
You must be signed in to change notification settings - Fork 21.3k
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
Move types to the top level ActiveRecord
namespace
#15370
Conversation
@@ -2,7 +2,7 @@ module ActiveRecord | |||
module Properties | |||
extend ActiveSupport::Concern | |||
|
|||
Type = ConnectionAdapters::Type | |||
Type = ActiveRecord::Type |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we still need the alias? I think it will resolve fine
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, otherwise subclasses of ActiveRecord::Base
won't resolve the constant properly.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It should since Type is inside the same namespace. I think it is missing the autoload definition inside ActiveRecord.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Subclasses of ActiveRecord::Base
shouldn't inherit constants defined in the ActiveRecord
namespace.
module Foo
OUTER_CONST = "outer"
module Bar
MODULE_CONST = "module"
end
class Baz
include Bar
PARENT_CONST = "parent"
end
end
class FooBaz < Foo::Baz
PARENT_CONST
MODULE_CONST
OUTER_CONST # => this line errors
end
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Right!
Just rebase and make sure you add the |
`ActiveRecord::ConnectionAdapters::Type::Value` => `ActiveRecord::Type::Value`
Done |
@rafaelfranca The build failure was memcache, not the changes in this PR. |
Move types to the top level `ActiveRecord` namespace
ActiveRecord::ConnectionAdapters::Type::Value
=>ActiveRecord::Type::Value