Sha256: 7f44a9317cb4827630c7dc70f22edaaf1dc60fe9eda79035f1797fbbcbc08a63

Contents?: true

Size: 698 Bytes

Versions: 2

Compression:

Stored size: 698 Bytes

Contents

module Guts
  # Navigation model
  class Navigation < ActiveRecord::Base
    extend FriendlyId
    include TrackableConcern
    include MultisiteScopeConcern

    validates :title, presence: true

    belongs_to :site
    has_many :tracks, as: :object
    has_many :navigation_items, dependent: :destroy
    has_many :media, as: :filable, dependent: :destroy
    has_many :metafields, as: :fieldable, dependent: :destroy

    friendly_id :title, use: [:slugged, :scoped, :finders], scope: :site_id
    trackable :create, :update, :destroy, fields: [:title]

    # Updates slug if title changes
    # @return [Boolean]
    def should_generate_new_friendly_id?
      title_changed?
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
guts-1.4.0 app/models/guts/navigation.rb
guts-1.3.6 app/models/guts/navigation.rb