Sha256: 3eb17bc38c3b4fb05b615de3a71496bb9ec131a24f3de3396a0a4affeffea259

Contents?: true

Size: 779 Bytes

Versions: 13

Compression:

Stored size: 779 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: "privacy_policy") }

      private
        def set_defaults
          self.pathname     ||= "/cmor/legal/"
          self.basename     ||= "privacy_policy"
          self.handler      ||= "textile"
          self.published_at ||= Time.zone.now
        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

13 entries across 13 versions & 1 rubygems

Version Path
cmor_legal-0.0.60.pre app/models/cmor/legal/privacy_policy.rb
cmor_legal-0.0.59.pre app/models/cmor/legal/privacy_policy.rb
cmor_legal-0.0.58.pre app/models/cmor/legal/privacy_policy.rb
cmor_legal-0.0.57.pre app/models/cmor/legal/privacy_policy.rb
cmor_legal-0.0.56.pre app/models/cmor/legal/privacy_policy.rb
cmor_legal-0.0.55.pre app/models/cmor/legal/privacy_policy.rb
cmor_legal-0.0.54.pre app/models/cmor/legal/privacy_policy.rb
cmor_legal-0.0.53.pre app/models/cmor/legal/privacy_policy.rb
cmor_legal-0.0.52.pre app/models/cmor/legal/privacy_policy.rb
cmor_legal-0.0.51.pre app/models/cmor/legal/privacy_policy.rb
cmor_legal-0.0.50.pre app/models/cmor/legal/privacy_policy.rb
cmor_legal-0.0.49.pre app/models/cmor/legal/privacy_policy.rb
cmor_legal-0.0.48.pre app/models/cmor/legal/privacy_policy.rb