Skip to content
Browse files

Prevent concatenating WHERE conditions from previous query.

  • Loading branch information...
1 parent bcbee4e commit 3c59ffe8e8609fffad1c3796abf132b23a98ae1d @christoph-buente christoph-buente committed
Showing with 4 additions and 1 deletion.
  1. +4 −1 lib/big_sitemap.rb
View
5 lib/big_sitemap.rb
@@ -260,6 +260,9 @@ def generate_models
find_options[key] = options.delete(key)
end
+ # Keep the intial conditions for later user
+ conditions = find_options[:conditions]
+
primary_method = options.delete(:primary_column)
primary_column = "#{table_name(model)}.#{primary_method}"
@@ -287,7 +290,7 @@ def generate_models
if last_id && primary_column
find_options.update(:limit => limit, :offset => nil)
primary_column_value = escape_if_string last_id #escape '
- find_options.update(:conditions => [find_options[:conditions], "(#{primary_column} > #{primary_column_value})"].compact.join(' AND '))
+ find_options[:conditions] = [conditions, "(#{primary_column} > #{primary_column_value})"].compact.join(' AND ')
end
model.send(find_method, find_options).each do |record|

0 comments on commit 3c59ffe

Please sign in to comment.
Something went wrong with that request. Please try again.