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.26.8 app/models/concerns/decidim/templates/templatable.rb
decidim-templates-0.27.4 app/models/concerns/decidim/templates/templatable.rb
decidim-templates-0.27.3 app/models/concerns/decidim/templates/templatable.rb
decidim-templates-0.26.7 app/models/concerns/decidim/templates/templatable.rb
decidim-templates-0.26.5 app/models/concerns/decidim/templates/templatable.rb
decidim-templates-0.27.2 app/models/concerns/decidim/templates/templatable.rb
decidim-templates-0.27.1 app/models/concerns/decidim/templates/templatable.rb
decidim-templates-0.26.4 app/models/concerns/decidim/templates/templatable.rb
decidim-templates-0.27.0 app/models/concerns/decidim/templates/templatable.rb
decidim-templates-0.26.3 app/models/concerns/decidim/templates/templatable.rb
decidim-templates-0.27.0.rc2 app/models/concerns/decidim/templates/templatable.rb
decidim-templates-0.27.0.rc1 app/models/concerns/decidim/templates/templatable.rb
decidim-templates-0.26.2 app/models/concerns/decidim/templates/templatable.rb
decidim-templates-0.26.1 app/models/concerns/decidim/templates/templatable.rb
decidim-templates-0.26.0 app/models/concerns/decidim/templates/templatable.rb
decidim-templates-0.26.0.rc2 app/models/concerns/decidim/templates/templatable.rb
decidim-templates-0.26.0.rc1 app/models/concerns/decidim/templates/templatable.rb
decidim-templates-0.25.2 app/models/concerns/decidim/templates/templatable.rb
decidim-templates-0.25.1 app/models/concerns/decidim/templates/templatable.rb
decidim-templates-0.25.0 app/models/concerns/decidim/templates/templatable.rb