diff options
Diffstat (limited to 'activerecord/lib/active_record')
-rw-r--r-- | activerecord/lib/active_record/associations/association_scope.rb | 14 | ||||
-rw-r--r-- | activerecord/lib/active_record/attribute_methods/dirty.rb | 6 |
2 files changed, 10 insertions, 10 deletions
diff --git a/activerecord/lib/active_record/associations/association_scope.rb b/activerecord/lib/active_record/associations/association_scope.rb index 56a7df0944..2972b7e13e 100644 --- a/activerecord/lib/active_record/associations/association_scope.rb +++ b/activerecord/lib/active_record/associations/association_scope.rb @@ -38,13 +38,18 @@ module ActiveRecord columns[column_name] end - def bind(scope, column, value) + def bind_value(scope, column, value) substitute = alias_tracker.connection.substitute_at( column, scope.bind_values.length) scope.bind_values += [[column, value]] substitute end + def bind(scope, table_name, column_name, value) + column = column_for table_name, column_name + bind_value scope, column, value + end + def add_constraints(scope) tables = construct_tables @@ -79,12 +84,13 @@ module ActiveRecord conditions = self.conditions[i] if reflection == chain.last - column = column_for(table.table_name, key.to_s) - bind_val = bind(scope, column, owner[foreign_key]) + bind_val = bind scope, table.table_name, key.to_s, owner[foreign_key] scope = scope.where(table[key].eq(bind_val)) if reflection.type - scope = scope.where(table[reflection.type].eq(owner.class.base_class.name)) + value = owner.class.base_class.name + bind_val = bind scope, table.table_name, reflection.type.to_s, value + scope = scope.where(table[reflection.type].eq(bind_val)) end conditions.each do |condition| diff --git a/activerecord/lib/active_record/attribute_methods/dirty.rb b/activerecord/lib/active_record/attribute_methods/dirty.rb index 433d508357..3a737e5b35 100644 --- a/activerecord/lib/active_record/attribute_methods/dirty.rb +++ b/activerecord/lib/active_record/attribute_methods/dirty.rb @@ -58,8 +58,6 @@ module ActiveRecord @changed_attributes.delete(attr) unless _field_changed?(attr, old, value) else old = clone_attribute_value(:read_attribute, attr) - # Save Time objects as TimeWithZone if time_zone_aware_attributes == true - old = old.in_time_zone if clone_with_time_zone_conversion_attribute?(attr, old) @changed_attributes[attr] = old if _field_changed?(attr, old, value) end @@ -92,10 +90,6 @@ module ActiveRecord old != value end - - def clone_with_time_zone_conversion_attribute?(attr, old) - old.class.name == "Time" && time_zone_aware_attributes && !self.skip_time_zone_conversion_for_attributes.include?(attr.to_sym) - end end end end |