lib/big_sitemap.rb in big_sitemap-1.0.1 vs lib/big_sitemap.rb in big_sitemap-1.0.2
- old
+ new
@@ -176,10 +176,11 @@
def add_urls
return self if Array(@paths).empty?
with_sitemap do |builder|
+ @paths.uniq!
@paths.each do |path, options|
url = URI.join(@options[:base_url], path)
builder.add_url! url, options
end
end
@@ -258,10 +259,13 @@
find_options = {}
[:conditions, :limit, :joins, :select, :order, :include, :group].each do |key|
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}"
count = model.send(count_method, find_options.merge(:select => (primary_column || '*'), :include => nil))
count = find_options[:limit].to_i if find_options[:limit] && find_options[:limit].to_i < count
@@ -285,11 +289,11 @@
find_options.update(:limit => limit, :offset => offset) if num_batches > 1
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|
last_mod = options[:last_modified]
if last_mod.is_a?(Proc)
@@ -376,12 +380,9 @@
options[:partial_update] ||= @options[:partial_update]
options[:start_part_id] ||= first_id_of_last_sitemap
sitemap = if options[:type] == 'index'
IndexBuilder.new(options)
- elsif options[:geo]
- options[:filename] << '_kml'
- GeoBuilder.new(options)
else
Builder.new(options)
end
begin