lib/big_sitemap.rb in alexrabarts-big_sitemap-0.3.2 vs lib/big_sitemap.rb in alexrabarts-big_sitemap-0.3.3
- old
+ new
@@ -115,12 +115,11 @@
last_mod_method = pick_method(record, TIMESTAMP_METHODS)
last_mod = last_mod_method.nil? ? Time.now : record.send(last_mod_method)
param_method = pick_method(record, PARAM_METHODS)
- location = defined?(Rails) ?
- polymorphic_url(record) :
- "#{root_url}/#{strip_leading_slash(options[:path])}/#{record.send(param_method)}"
+ location = defined?(Rails) ? polymorphic_url(record) : nil rescue nil
+ location ||= "#{root_url}/#{strip_leading_slash(options[:path])}/#{record.send(param_method)}"
change_frequency = options[:change_frequency] || 'weekly'
freq = change_frequency.is_a?(Proc) ? change_frequency.call(record) : change_frequency
priority = options[:priority]