Sha256: ce60f79354d731ad0267582409cf82cf68d96ff38dae7b1b6f81547eb8636863

Contents?: true

Size: 337 Bytes

Versions: 5

Compression:

Stored size: 337 Bytes

Contents

module Kms
  module Permalinkable
    extend ActiveSupport::Concern

    # Entity should respond to "slug"
    def permalink
      templatable_page = Kms::Page.where(templatable_type: self.class.name).first
      if templatable_page
        Pathname.new(templatable_page.parent.fullpath).join(slug.to_s).to_s
      end
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
kms-1.2.1 app/models/concerns/kms/permalinkable.rb
kms-1.2.0 app/models/concerns/kms/permalinkable.rb
kms-1.1.0 app/models/concerns/kms/permalinkable.rb
kms-1.0.1 app/models/concerns/kms/permalinkable.rb
kms-1.0.0 app/models/concerns/kms/permalinkable.rb