diff options
author | Eugene Kenny <elkenny@gmail.com> | 2017-07-07 00:53:02 +0100 |
---|---|---|
committer | Eugene Kenny <elkenny@gmail.com> | 2017-07-07 00:53:02 +0100 |
commit | dff37ff613d12201c2b770dbc61b125792c7bb6e (patch) | |
tree | 6336cb2af1e6dd6aae55fe05033058c8716881bd /activerecord/lib/active_record/attribute_methods | |
parent | c879649a733d982fba9e70f5a280d13636b67c37 (diff) | |
download | rails-dff37ff613d12201c2b770dbc61b125792c7bb6e.tar.gz rails-dff37ff613d12201c2b770dbc61b125792c7bb6e.tar.bz2 rails-dff37ff613d12201c2b770dbc61b125792c7bb6e.zip |
Rename raw_write_attribute to write_attribute_without_type_cast
This name more accurately describes what the method does, and also
disambiguates it from `_write_attribute`, which ignores aliases.
We can also make the method private, since it's not public API and only
called from one place - `update_columns` - without an explicit receiver.
Diffstat (limited to 'activerecord/lib/active_record/attribute_methods')
-rw-r--r-- | activerecord/lib/active_record/attribute_methods/dirty.rb | 2 | ||||
-rw-r--r-- | activerecord/lib/active_record/attribute_methods/write.rb | 12 |
2 files changed, 7 insertions, 7 deletions
diff --git a/activerecord/lib/active_record/attribute_methods/dirty.rb b/activerecord/lib/active_record/attribute_methods/dirty.rb index 76987fb8f4..7bf5c7485f 100644 --- a/activerecord/lib/active_record/attribute_methods/dirty.rb +++ b/activerecord/lib/active_record/attribute_methods/dirty.rb @@ -80,7 +80,7 @@ module ActiveRecord clear_mutation_trackers end - def raw_write_attribute(attr_name, *) + def write_attribute_without_type_cast(attr_name, *) result = super clear_attribute_change(attr_name) result diff --git a/activerecord/lib/active_record/attribute_methods/write.rb b/activerecord/lib/active_record/attribute_methods/write.rb index d7ddd35dff..54b673c72e 100644 --- a/activerecord/lib/active_record/attribute_methods/write.rb +++ b/activerecord/lib/active_record/attribute_methods/write.rb @@ -39,12 +39,6 @@ module ActiveRecord _write_attribute(name, value) end - def raw_write_attribute(attr_name, value) # :nodoc: - name = attr_name.to_s - @attributes.write_cast_value(name, value) - value - end - # This method exists to avoid the expensive primary_key check internally, without # breaking compatibility with the write_attribute API def _write_attribute(attr_name, value) # :nodoc: @@ -53,6 +47,12 @@ module ActiveRecord end private + def write_attribute_without_type_cast(attr_name, value) + name = attr_name.to_s + @attributes.write_cast_value(name, value) + value + end + # Handle *= for method_missing. def attribute=(attribute_name, value) _write_attribute(attribute_name, value) |