1
0
Fork 0
mirror of https://github.com/rails/rails.git synced 2022-11-09 12:12:34 -05:00

Fixes an issue where time_zone_conversion that causes an exception in ARs delegation

Following off of https://github.com/rails/rails/issues/15945, I realized that super
needs to be the first thing that is called in an AbstractModel's inherited method.
I was receiving errors within the inherited method of time_zone_conversion, so I tested
locally by moving super to the top of the method declaration. All exceptions went away.
This commit is contained in:
Julian Nadeau 2016-10-27 13:22:55 -04:00
parent 7506f33906
commit 02063a8e63
No known key found for this signature in database
GPG key ID: 9E15A265E4C78589

View file

@ -70,6 +70,7 @@ module ActiveRecord
private private
def inherited(subclass) def inherited(subclass)
super
# We need to apply this decorator here, rather than on module inclusion. The closure # We need to apply this decorator here, rather than on module inclusion. The closure
# created by the matcher would otherwise evaluate for `ActiveRecord::Base`, not the # created by the matcher would otherwise evaluate for `ActiveRecord::Base`, not the
# sub class being decorated. As such, changes to `time_zone_aware_attributes`, or # sub class being decorated. As such, changes to `time_zone_aware_attributes`, or
@ -80,7 +81,6 @@ module ActiveRecord
TimeZoneConverter.new(type) TimeZoneConverter.new(type)
end end
end end
super
end end
def create_time_zone_conversion_attribute?(name, cast_type) def create_time_zone_conversion_attribute?(name, cast_type)