diff options
author | Max Lapshin <max@maxidoors.ru> | 2009-01-14 16:09:23 +0300 |
---|---|---|
committer | Michael Koziarski <michael@koziarski.com> | 2009-02-06 13:39:08 +1300 |
commit | 1fe9d6cc88dbad26e865c7c2bfd83da25796e2f1 (patch) | |
tree | c0e930054c46d346ed46653bdcd0a7200e1bf9b5 /activerecord/test | |
parent | 9c6bde58c52f63d9e40979b89bc5db0c786159da (diff) | |
download | rails-1fe9d6cc88dbad26e865c7c2bfd83da25796e2f1.tar.gz rails-1fe9d6cc88dbad26e865c7c2bfd83da25796e2f1.tar.bz2 rails-1fe9d6cc88dbad26e865c7c2bfd83da25796e2f1.zip |
Support true/false in query_attribute for calculated columns
Signed-off-by: Tarmo Tänav <tarmo@itech.ee>
Signed-off-by: Michael Koziarski <michael@koziarski.com>
Diffstat (limited to 'activerecord/test')
-rw-r--r-- | activerecord/test/cases/attribute_methods_test.rb | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/activerecord/test/cases/attribute_methods_test.rb b/activerecord/test/cases/attribute_methods_test.rb index 77ee8d8fc4..759f9f3872 100644 --- a/activerecord/test/cases/attribute_methods_test.rb +++ b/activerecord/test/cases/attribute_methods_test.rb @@ -56,6 +56,18 @@ class AttributeMethodsTest < ActiveRecord::TestCase assert_equal myobj, topic.content end + def test_typecast_attribute_from_select_to_false + topic = Topic.create(:title => 'Budget') + topic = Topic.find(:first, :select => "topics.*, 1=2 as is_test") + assert !topic.is_test? + end + + def test_typecast_attribute_from_select_to_true + topic = Topic.create(:title => 'Budget') + topic = Topic.find(:first, :select => "topics.*, 2=2 as is_test") + assert topic.is_test? + end + def test_kernel_methods_not_implemented_in_activerecord %w(test name display y).each do |method| assert !ActiveRecord::Base.instance_method_already_implemented?(method), "##{method} is defined" |