diff options
author | Guillermo Iguaran <guilleiguaran@gmail.com> | 2017-02-21 21:04:04 +0900 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-02-21 21:04:04 +0900 |
commit | 5716c4ddf4e03c75bd50df901a515ac445167a99 (patch) | |
tree | 0cfb205b0f2711563b1f746c2c34acff8b4337c3 /activerecord/test/cases | |
parent | ba22c5ee84e7bbd22a3ba97eaa1d0bf9619cbfea (diff) | |
parent | 0b157f8ded03ef988308a135e12c9bc99a1cc703 (diff) | |
download | rails-5716c4ddf4e03c75bd50df901a515ac445167a99.tar.gz rails-5716c4ddf4e03c75bd50df901a515ac445167a99.tar.bz2 rails-5716c4ddf4e03c75bd50df901a515ac445167a99.zip |
Merge pull request #28092 from sikachu/fix-define_attribute_method-with-symbol-in-ar
Fix `define_attribute_method` with Symbol in AR
Diffstat (limited to 'activerecord/test/cases')
-rw-r--r-- | activerecord/test/cases/attribute_methods_test.rb | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/activerecord/test/cases/attribute_methods_test.rb b/activerecord/test/cases/attribute_methods_test.rb index 3dc0c0ce53..4d24a980dc 100644 --- a/activerecord/test/cases/attribute_methods_test.rb +++ b/activerecord/test/cases/attribute_methods_test.rb @@ -866,6 +866,13 @@ class AttributeMethodsTest < ActiveRecord::TestCase assert subklass.method_defined?(:id), "subklass is missing id method" end + test "define_attribute_method works with both symbol and string" do + klass = Class.new(ActiveRecord::Base) + + assert_nothing_raised { klass.define_attribute_method(:foo) } + assert_nothing_raised { klass.define_attribute_method("bar") } + end + test "read_attribute with nil should not asplode" do assert_nil Topic.new.read_attribute(nil) end |