diff options
author | Jeremy Kemper <jeremy@bitsweat.net> | 2009-04-30 20:32:19 -0700 |
---|---|---|
committer | Jeremy Kemper <jeremy@bitsweat.net> | 2009-04-30 20:32:19 -0700 |
commit | 4bb6f77059a34ea7c8575523397032b4cc67e00a (patch) | |
tree | 08161873fc88e3f8588f604fa0209b59d07df4e4 /activerecord/lib/active_record/base.rb | |
parent | 59b58dfa8915921798cc26142457607bc7085eb9 (diff) | |
download | rails-4bb6f77059a34ea7c8575523397032b4cc67e00a.tar.gz rails-4bb6f77059a34ea7c8575523397032b4cc67e00a.tar.bz2 rails-4bb6f77059a34ea7c8575523397032b4cc67e00a.zip |
Work around count returning string (bug)
Diffstat (limited to 'activerecord/lib/active_record/base.rb')
-rwxr-xr-x | activerecord/lib/active_record/base.rb | 2 |
1 files changed, 1 insertions, 1 deletions
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. |