Sha256: d10ba14284e9f30511bb46e925edad182b9aa74b2e02fad4e4aed1c9ace99632

Contents?: true

Size: 711 Bytes

Versions: 1

Compression:

Stored size: 711 Bytes

Contents

# frozen_string_literal: true

module Cmor
  module Legal
    class PrivacyPolicy < Cmor::Cms::Page
      after_initialize :set_defaults, if: :new_record?
      before_validation :set_locale_dependent_defaults, if: :new_record?

      default_scope { where(pathname: "/cmor/legal/", basename: "show") }

      private
        def set_defaults
          self.pathname ||= "/cmor/legal/"
          self.basename ||= "privacy_policy"
          self.handler  ||= "textile"
        end

        def set_locale_dependent_defaults
          return unless self.locale.present?
          self.title    ||= I18n.with_locale(self.locale) { I18n.t("cmor.legal.privacy_policy.default_title") }
        end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
cmor_legal-0.0.45.pre app/models/cmor/legal/privacy_policy.rb