Sha256: 1622b481dbd37e413559fbce393b9ce6e4a54de7b891cccbe10850a7194ff19c

Contents?: true

Size: 324 Bytes

Versions: 2

Compression:

Stored size: 324 Bytes

Contents

module Petrie
  class Page < ActiveRecord::Base
    extend FriendlyId
    friendly_id :title, use: [:scoped, :slugged], scope: :parent

    acts_as_nested_set

    def should_generate_new_friendly_id?
      title_changed?
    end

    def top_ancestor
      return parent.top_ancestor if parent
      self
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
petrie-0.1.1 app/models/petrie/page.rb
petrie-0.1.0 app/models/petrie/page.rb