aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/test
diff options
context:
space:
mode:
authorRafael Mendonça França <rafaelmfranca@gmail.com>2013-04-19 12:36:53 -0700
committerRafael Mendonça França <rafaelmfranca@gmail.com>2013-04-19 12:36:53 -0700
commita489bfe48bc0fbbb50a472bc66bd42d408c73fcb (patch)
tree838c9686ec081959b7e6f9b007f290212d3bad25 /activerecord/test
parent08c6df8532a1884050c8e9087e9fce9df6528ae2 (diff)
parent66001f360661fefad89d9e271b9ff75a86b4b886 (diff)
downloadrails-a489bfe48bc0fbbb50a472bc66bd42d408c73fcb.tar.gz
rails-a489bfe48bc0fbbb50a472bc66bd42d408c73fcb.tar.bz2
rails-a489bfe48bc0fbbb50a472bc66bd42d408c73fcb.zip
Merge pull request #10211 from neerajdotname/4208
fix respond_to? for non selected column
Diffstat (limited to 'activerecord/test')
-rw-r--r--activerecord/test/cases/relation_test.rb5
1 files changed, 5 insertions, 0 deletions
diff --git a/activerecord/test/cases/relation_test.rb b/activerecord/test/cases/relation_test.rb
index 34ecdb3cc9..06723b9d7f 100644
--- a/activerecord/test/cases/relation_test.rb
+++ b/activerecord/test/cases/relation_test.rb
@@ -185,6 +185,11 @@ module ActiveRecord
assert_equal 3, authors(:david).posts.merge(posts_with_special_comments_with_ratings).count.length
end
+ def test_respond_to_for_non_selected_element
+ post = Post.select("'title' as post_title").first
+ assert !post.respond_to?(:body), "post should not respond_to?(:body) since invoking it raises exception"
+ end
+
end
class RelationMutationTest < ActiveSupport::TestCase