Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Merge pull request #8202 from nikitug/regression_test_on_dynamic_find…

…er_result

Regression test for #7238
  • Loading branch information...
commit 087150d9b7a73f20677f9bc3ff52fe66b1f1e549 2 parents 3a33572 + 8424d0d
@carlosantoniodasilva carlosantoniodasilva authored
View
7 activerecord/test/cases/finder_test.rb
@@ -610,6 +610,13 @@ def test_find_by_one_attribute_that_is_an_alias
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
View
6 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'
Please sign in to comment.
Something went wrong with that request. Please try again.