From 4bb6f77059a34ea7c8575523397032b4cc67e00a Mon Sep 17 00:00:00 2001 From: Jeremy Kemper Date: Thu, 30 Apr 2009 20:32:19 -0700 Subject: Work around count returning string (bug) --- activerecord/lib/active_record/base.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'activerecord/lib') diff --git a/activerecord/lib/active_record/base.rb b/activerecord/lib/active_record/base.rb index 26c11e2dda..4c23d2f8e2 100755 --- a/activerecord/lib/active_record/base.rb +++ b/activerecord/lib/active_record/base.rb @@ -690,7 +690,7 @@ module ActiveRecord #:nodoc: def exists?(id_or_conditions = {}) construct_finder_arel({ :conditions =>expand_id_conditions(id_or_conditions) - }).project(arel_table[primary_key]).take(1).count > 0 + }).project(arel_table[primary_key]).take(1).count.to_i > 0 end # Creates an object (or multiple objects) and saves it to the database, if validations pass. -- cgit v1.2.3