From b63701e272f3dc932ba7a20127f6dc82b567cfb4 Mon Sep 17 00:00:00 2001 From: Sean Griffin Date: Tue, 30 Oct 2018 12:52:23 -0600 Subject: `update_columns` raises if the column is unknown Previosly, `update_columns` would just take whatever keys you gave it and tried to run the update query. Most likely this would result in an error from the database. However, if the column actually did exist, but was in `ignored_columns`, this would result in the method returning successfully when it should have raised, and an attribute that should not exist written to `@attributes`. --- activemodel/lib/active_model/attribute.rb | 1 + 1 file changed, 1 insertion(+) (limited to 'activemodel/lib/active_model') diff --git a/activemodel/lib/active_model/attribute.rb b/activemodel/lib/active_model/attribute.rb index 3f19cda07b..75f60d205e 100644 --- a/activemodel/lib/active_model/attribute.rb +++ b/activemodel/lib/active_model/attribute.rb @@ -206,6 +206,7 @@ module ActiveModel raise ActiveModel::MissingAttributeError, "can't write unknown attribute `#{name}`" end alias_method :with_value_from_user, :with_value_from_database + alias_method :with_cast_value, :with_value_from_database end class Uninitialized < Attribute # :nodoc: -- cgit v1.2.3