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.25.0.rc4 app/models/concerns/decidim/templates/templatable.rb
decidim-templates-0.25.0.rc3 app/models/concerns/decidim/templates/templatable.rb
decidim-templates-0.25.0.rc2 app/models/concerns/decidim/templates/templatable.rb
decidim-templates-0.25.0.rc1 app/models/concerns/decidim/templates/templatable.rb
decidim-templates-0.24.3 app/models/concerns/decidim/templates/templatable.rb
decidim-templates-0.23.6 app/models/concerns/decidim/templates/templatable.rb
decidim-templates-0.24.2 app/models/concerns/decidim/templates/templatable.rb
decidim-templates-0.23.5 app/models/concerns/decidim/templates/templatable.rb
decidim-templates-0.24.1 app/models/concerns/decidim/templates/templatable.rb
decidim-templates-0.24.0 app/models/concerns/decidim/templates/templatable.rb
decidim-templates-0.24.0.rc2 app/models/concerns/decidim/templates/templatable.rb
decidim-templates-0.23.4 app/models/concerns/decidim/templates/templatable.rb
decidim-templates-0.24.0.rc1 app/models/concerns/decidim/templates/templatable.rb
decidim-templates-0.23.3 app/models/concerns/decidim/templates/templatable.rb
decidim-templates-0.23.2 app/models/concerns/decidim/templates/templatable.rb
decidim-templates-0.23.1 app/models/concerns/decidim/templates/templatable.rb
decidim-templates-0.23.1.rc1 app/models/concerns/decidim/templates/templatable.rb
decidim-templates-0.23.0 app/models/concerns/decidim/templates/templatable.rb