Sha256: 907850a8613ee938c8571d3e57f60bbb1975cdafee5117816456e9050103a3be

Contents?: true

Size: 786 Bytes

Versions: 54

Compression:

Stored size: 786 Bytes

Contents

class Content < ApplicationRecord
  self.abstract_class = true

  include Mumuki::Domain::Syncable
  include WithDescription
  include WithLocale
  include WithMedal
  include WithName
  include WithProgress
  include WithSlug
  include WithUsages

  def to_resource_h(*args)
    to_expanded_resource_h(*args).compact
  end

  def to_expanded_resource_h(*)
    as_json(only: [:name, :slug, :description, :locale]).symbolize_keys
  end

  def fork_to!(organization, syncer, quiet: false)
    rebased_dup(organization).tap do |dup|
      self.class.find_by(slug: dup.slug).try { |it| return it } if quiet

      dup.validate!
      fork_children_into! dup, organization, syncer
      dup.save validate: false

      syncer.export! dup
    end
  end

  def public?
    !private?
  end
end

Version data entries

54 entries across 54 versions & 2 rubygems

Version Path
mumuki-domain-9.23.0 app/models/content.rb
mumuki-domain-9.22.1 app/models/content.rb
mumuki-domain-9.22.0 app/models/content.rb
mumuki-domain-9.21.0 app/models/content.rb
mumuki-domain-9.20.0 app/models/content.rb
mumuki-domain-9.19.0 app/models/content.rb
mumuki-domain-9.18.0 app/models/content.rb
mumuki-domain-9.17.0 app/models/content.rb
mumuki-domain-9.16.0 app/models/content.rb
mumuki-domain-9.15.0 app/models/content.rb
mumuki-domain-9.14.1 app/models/content.rb
mumuki-domain-9.14.0 app/models/content.rb
mumuki-domain-9.13.1 app/models/content.rb
mumuki-domain-9.13.0 app/models/content.rb
mumuki-domain-9.12.0 app/models/content.rb
mumuki-domain-9.11.0 app/models/content.rb
mumuki-domain-9.10.0 app/models/content.rb
mumuki-domain-9.9.0 app/models/content.rb
mumuki-domain-9.8.1 app/models/content.rb
mumuki-domain-9.8.0 app/models/content.rb