From b56376b4509073a0ef7fc0a44e51619f1bf11d8e Mon Sep 17 00:00:00 2001 From: Nikita Afanasenko Date: Tue, 13 Nov 2012 21:19:48 +0400 Subject: Use nil? instead of blank? to check dynamic finder result It's safe to use `nil?` instead of `blank?` because it's impossible to get an array on finder with bang; `all_by` finder matches against regex without bang: `when /^find_(all_|last_)?by_([_a-zA-Z]\w*)$/`. Fixes #7238 --- activerecord/test/models/topic.rb | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'activerecord/test/models') diff --git a/activerecord/test/models/topic.rb b/activerecord/test/models/topic.rb index 1a1a18166a..5166fefe81 100644 --- a/activerecord/test/models/topic.rb +++ b/activerecord/test/models/topic.rb @@ -112,6 +112,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' -- cgit v1.2.3