diff options
author | Rafael França <rafaelmfranca@gmail.com> | 2018-11-29 15:31:24 -0500 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-11-29 15:31:24 -0500 |
commit | 5b75408e3226b43fab66558d173df7e97efbc240 (patch) | |
tree | 207983063d7581829ae42f59574f662737076aa7 /activerecord/test/cases | |
parent | c8e4d5a1e3be2290bc6007987e40312e19480474 (diff) | |
parent | 72e63c71bb3f73870e280964def25b7578818b1b (diff) | |
download | rails-5b75408e3226b43fab66558d173df7e97efbc240.tar.gz rails-5b75408e3226b43fab66558d173df7e97efbc240.tar.bz2 rails-5b75408e3226b43fab66558d173df7e97efbc240.zip |
Merge pull request #34569 from gmcgibbon/allow_attribute_aliases_in_update
Allow aliased attributes in update
Diffstat (limited to 'activerecord/test/cases')
-rw-r--r-- | activerecord/test/cases/attribute_methods_test.rb | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/activerecord/test/cases/attribute_methods_test.rb b/activerecord/test/cases/attribute_methods_test.rb index 12a4027a4e..d341dd0083 100644 --- a/activerecord/test/cases/attribute_methods_test.rb +++ b/activerecord/test/cases/attribute_methods_test.rb @@ -323,6 +323,12 @@ class AttributeMethodsTest < ActiveRecord::TestCase assert_raises(ActiveModel::UnknownAttributeError) { topic.update(no_column_exists: "Hello!") } end + test "write_attribute allows writing to aliased attributes" do + topic = Topic.first + assert_nothing_raised { topic.update_columns(heading: "Hello!") } + assert_nothing_raised { topic.update(heading: "Hello!") } + end + test "read_attribute" do topic = Topic.new topic.title = "Don't change the topic" |