app/models/spotlight/exhibit.rb in blacklight-spotlight-0.7.2 vs app/models/spotlight/exhibit.rb in blacklight-spotlight-0.8.0

- old
+ new

@@ -2,11 +2,14 @@ module Spotlight ## # Spotlight exhibit class Exhibit < ActiveRecord::Base include Spotlight::ExhibitAnalytics + include Spotlight::ExhibitDocuments + scope :published, -> { where(published: true) } + extend FriendlyId friendly_id :title, use: [:slugged, :finders] validates :title, presence: true acts_as_tagger @@ -45,25 +48,10 @@ before_create :build_home_page after_create :initialize_config after_create :initialize_browse after_create :initialize_main_navigation - after_destroy do - # Touch the default exhibit to ensure caching knows that - # the exhibits have changed. - Spotlight::Exhibit.default.touch - end - - # Find or create the default exhibit - def self.default - self.find_or_create_by!(default: true) do |e| - e.title = 'Default exhibit'.freeze - end - end - - def self.default? - where(default: true).any? - end + scope :published, -> { where(published: true) } def main_about_page @main_about_page ||= about_pages.published.first end