diff options
author | Carlos Antonio da Silva <carlosantoniodasilva@gmail.com> | 2012-11-13 06:59:17 -0800 |
---|---|---|
committer | Carlos Antonio da Silva <carlosantoniodasilva@gmail.com> | 2012-11-13 06:59:17 -0800 |
commit | 087150d9b7a73f20677f9bc3ff52fe66b1f1e549 (patch) | |
tree | 8e70e7b77cbba116275874b0d5979092e19b8273 | |
parent | 3a335720db249700c3d7d51ee450a6bf22aff5fd (diff) | |
parent | 8424d0dda3a991b735365e993d907827a1913480 (diff) | |
download | rails-087150d9b7a73f20677f9bc3ff52fe66b1f1e549.tar.gz rails-087150d9b7a73f20677f9bc3ff52fe66b1f1e549.tar.bz2 rails-087150d9b7a73f20677f9bc3ff52fe66b1f1e549.zip |
Merge pull request #8202 from nikitug/regression_test_on_dynamic_finder_result
Regression test for #7238
-rw-r--r-- | activerecord/test/cases/finder_test.rb | 7 | ||||
-rw-r--r-- | activerecord/test/models/topic.rb | 6 |
2 files changed, 13 insertions, 0 deletions
diff --git a/activerecord/test/cases/finder_test.rb b/activerecord/test/cases/finder_test.rb index d44ac21b05..f68d7de3ae 100644 --- a/activerecord/test/cases/finder_test.rb +++ b/activerecord/test/cases/finder_test.rb @@ -610,6 +610,13 @@ class FinderTest < ActiveRecord::TestCase assert_nil Topic.find_by_heading("The First Topic!") end + def test_find_by_one_attribute_bang_with_blank_defined + BlankTopic.create(title: "The Blank One") + assert_nothing_raised do + BlankTopic.find_by_title!("The Blank One") + end + end + def test_find_by_one_attribute_with_conditions assert_equal accounts(:rails_core_account), Account.where('firm_id = ?', 6).find_by_credit_limit(50) end diff --git a/activerecord/test/models/topic.rb b/activerecord/test/models/topic.rb index ab31d85e46..f7f4cebc5a 100644 --- a/activerecord/test/models/topic.rb +++ b/activerecord/test/models/topic.rb @@ -107,6 +107,12 @@ class ImportantTopic < Topic serialize :important, Hash end +class BlankTopic < Topic + def blank? + true + end +end + module Web class Topic < ActiveRecord::Base has_many :replies, :dependent => :destroy, :foreign_key => "parent_id", :class_name => 'Web::Reply' |