Sha256: 80f8f8697a34092458ba4f156f1d4bb4befbd806c836d58fffda9b5b7856548a

Contents?: true

Size: 444 Bytes

Versions: 5

Compression:

Stored size: 444 Bytes

Contents

module SimpleContentManagement::Breadcrumbs
	def reconstruct_breadcrumbs
		pages = SimpleContentManagement::SimplePage.active.all
		menu_items = SimpleContentManagement::SimpleMenuItem.all
		menu_item_ids = menu_items.map(&:id)

		pages.each do |page|
			next if menu_item_ids.include?(page.preferred_menu_item_id) || page.simple_menu_items.first.nil?
			page.preferred_menu_item_id = page.simple_menu_items.first.id
			page.save
		end
	end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
th_simple_content_management-0.2.7 lib/simple_content_management/breadcrumbs.rb
th_simple_content_management-0.2.6 lib/simple_content_management/breadcrumbs.rb
th_simple_content_management-0.2.5 lib/simple_content_management/breadcrumbs.rb
th_simple_content_management-0.2.4 lib/simple_content_management/breadcrumbs.rb
th_simple_content_management-0.2.3 lib/simple_content_management/breadcrumbs.rb