diff options
author | Jeremy Kemper <jeremy@bitsweat.net> | 2007-05-26 00:35:49 +0000 |
---|---|---|
committer | Jeremy Kemper <jeremy@bitsweat.net> | 2007-05-26 00:35:49 +0000 |
commit | 2be3a33f32b43287b692be2cc2550f159b00165e (patch) | |
tree | 4b5b55de4af68f8bc2b7d23b73687ba33d83bc77 /activerecord/lib | |
parent | 9dac6b759f57d93247ba6e8b8d8c7b9d5638dc22 (diff) | |
download | rails-2be3a33f32b43287b692be2cc2550f159b00165e.tar.gz rails-2be3a33f32b43287b692be2cc2550f159b00165e.tar.bz2 rails-2be3a33f32b43287b692be2cc2550f159b00165e.zip |
find gracefully copes with blank :conditions. Closes #7599.
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@6852 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
Diffstat (limited to 'activerecord/lib')
-rwxr-xr-x | activerecord/lib/active_record/base.rb | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/activerecord/lib/active_record/base.rb b/activerecord/lib/active_record/base.rb index 81b492e65e..3ba1cb26d1 100755 --- a/activerecord/lib/active_record/base.rb +++ b/activerecord/lib/active_record/base.rb @@ -1249,11 +1249,11 @@ module ActiveRecord #:nodoc: def add_conditions!(sql, conditions, scope = :auto) scope = scope(:find) if :auto == scope segments = [] - segments << sanitize_sql(scope[:conditions]) if scope && scope[:conditions] - segments << sanitize_sql(conditions) unless conditions.nil? + segments << sanitize_sql(scope[:conditions]) if scope && !scope[:conditions].blank? + segments << sanitize_sql(conditions) unless conditions.blank? segments << type_condition unless descends_from_active_record? segments.compact! - sql << "WHERE (#{segments.join(") AND (")}) " unless segments.empty? + sql << "WHERE (#{segments.join(") AND (")}) " unless segments.all?(&:blank?) end def type_condition |