module SitemapNotifier::ActiveRecord
Public Class Methods
included(base)
click to toggle source
# File lib/sitemap_notifier/active_record.rb, line 5 def self.included(base) [:create, :update, :destroy].each do |action| base.send("after_#{action}") do notify_sitemap(action) end end end
Public Instance Methods
notify_sitemap(action)
click to toggle source
# File lib/sitemap_notifier/active_record.rb, line 13 def notify_sitemap(action) notifier = SitemapNotifier::Notifier if (notifier.notify_of_changes_to?(self.class, action)) && notify_sitemap? notifier.run(sitemap_url) end end
notify_sitemap?()
click to toggle source
# File lib/sitemap_notifier/active_record.rb, line 21 def notify_sitemap? true end
sitemap_url()
click to toggle source
# File lib/sitemap_notifier/active_record.rb, line 25 def sitemap_url SitemapNotifier::Notifier.sitemap_url end