Sha256: 942564b9a46163a6885f78ca2f22d56fe538f22c776113ef057d7767aecf5ace

Contents?: true

Size: 573 Bytes

Versions: 58

Compression:

Stored size: 573 Bytes

Contents

# frozen_string_literal: true

require "active_support/concern"

module Decidim
  module Templates
    # A concern with the components needed when you want to create templates for a model
    module Templatable
      extend ActiveSupport::Concern

      included do
        has_one :template,
                class_name: "Decidim::Templates::Template",
                inverse_of: :templatable,
                dependent: :destroy,
                as: :templatable

        def pristine?
          created_at.to_i == updated_at.to_i
        end
      end
    end
  end
end

Version data entries

58 entries across 58 versions & 1 rubygems

Version Path
decidim-templates-0.29.1 app/models/concerns/decidim/templates/templatable.rb
decidim-templates-0.28.4 app/models/concerns/decidim/templates/templatable.rb
decidim-templates-0.27.9 app/models/concerns/decidim/templates/templatable.rb
decidim-templates-0.29.0 app/models/concerns/decidim/templates/templatable.rb
decidim-templates-0.28.3 app/models/concerns/decidim/templates/templatable.rb
decidim-templates-0.27.8 app/models/concerns/decidim/templates/templatable.rb
decidim-templates-0.29.0.rc4 app/models/concerns/decidim/templates/templatable.rb
decidim-templates-0.29.0.rc3 app/models/concerns/decidim/templates/templatable.rb
decidim-templates-0.29.0.rc2 app/models/concerns/decidim/templates/templatable.rb
decidim-templates-0.29.0.rc1 app/models/concerns/decidim/templates/templatable.rb
decidim-templates-0.28.2 app/models/concerns/decidim/templates/templatable.rb
decidim-templates-0.27.7 app/models/concerns/decidim/templates/templatable.rb
decidim-templates-0.28.1 app/models/concerns/decidim/templates/templatable.rb
decidim-templates-0.27.6 app/models/concerns/decidim/templates/templatable.rb
decidim-templates-0.26.10 app/models/concerns/decidim/templates/templatable.rb
decidim-templates-0.26.9 app/models/concerns/decidim/templates/templatable.rb
decidim-templates-0.28.0 app/models/concerns/decidim/templates/templatable.rb
decidim-templates-0.27.5 app/models/concerns/decidim/templates/templatable.rb
decidim-templates-0.28.0.rc5 app/models/concerns/decidim/templates/templatable.rb
decidim-templates-0.28.0.rc4 app/models/concerns/decidim/templates/templatable.rb