mirror of
https://github.com/rails/rails.git
synced 2022-11-09 12:12:34 -05:00
Use attribute_before_type_cast
in the internal
`read_attribute_before_type_cast` has become bit slower since #40395.
This commit is contained in:
parent
13bd289b44
commit
e47068c3f3
3 changed files with 4 additions and 4 deletions
|
@ -115,7 +115,7 @@ module ActiveModel
|
|||
|
||||
if record.respond_to?(came_from_user)
|
||||
if record.public_send(came_from_user)
|
||||
raw_value = record.read_attribute_before_type_cast(attr_name)
|
||||
raw_value = record.public_send(:"#{attr_name}_before_type_cast")
|
||||
elsif record.respond_to?(:read_attribute)
|
||||
raw_value = record.read_attribute(attr_name)
|
||||
end
|
||||
|
|
|
@ -31,7 +31,7 @@ module ActiveRecord
|
|||
|
||||
# Returns the primary key column's value before type cast.
|
||||
def id_before_type_cast
|
||||
read_attribute_before_type_cast(@primary_key)
|
||||
attribute_before_type_cast(@primary_key)
|
||||
end
|
||||
|
||||
# Returns the primary key column's previous value.
|
||||
|
|
|
@ -89,7 +89,7 @@ module ActiveRecord
|
|||
|
||||
begin
|
||||
locking_column = self.class.locking_column
|
||||
previous_lock_value = read_attribute_before_type_cast(locking_column)
|
||||
previous_lock_value = attribute_before_type_cast(locking_column)
|
||||
attribute_names = attribute_names.dup if attribute_names.frozen?
|
||||
attribute_names << locking_column
|
||||
|
||||
|
@ -121,7 +121,7 @@ module ActiveRecord
|
|||
|
||||
affected_rows = self.class._delete_record(
|
||||
@primary_key => id_in_database,
|
||||
locking_column => read_attribute_before_type_cast(locking_column)
|
||||
locking_column => attribute_before_type_cast(locking_column)
|
||||
)
|
||||
|
||||
if affected_rows != 1
|
||||
|
|
Loading…
Reference in a new issue