Sha256: 4738b5280446a076d94ad6b5e348f0f3de16ed37e8467553920159caf4159763

Contents?: true

Size: 766 Bytes

Versions: 32

Compression:

Stored size: 766 Bytes

Contents

class Content < ApplicationRecord
  self.abstract_class = true

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

  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

32 entries across 32 versions & 2 rubygems

Version Path
mumuki-domain-7.10.1 app/models/content.rb
mumuki-domain-7.10.0 app/models/content.rb
mumuki-laboratory-7.9.2 vendor/bundle/ruby/2.6.0/bundler/gems/mumuki-domain-7082a83493eb/app/models/content.rb
mumuki-domain-7.9.2 app/models/content.rb
mumuki-laboratory-7.9.1 vendor/bundle/ruby/2.6.0/bundler/gems/mumuki-domain-b162dc91aa77/app/models/content.rb
mumuki-domain-7.9.1 app/models/content.rb
mumuki-laboratory-7.9.0 vendor/bundle/ruby/2.6.0/bundler/gems/mumuki-domain-520f859ca8af/app/models/content.rb
mumuki-domain-7.9.0 app/models/content.rb
mumuki-domain-7.7.3 app/models/content.rb
mumuki-domain-7.8.1 app/models/content.rb
mumuki-domain-7.8.0 app/models/content.rb
mumuki-domain-7.7.2 app/models/content.rb
mumuki-domain-7.7.1 app/models/content.rb
mumuki-laboratory-7.7.1 vendor/bundle/ruby/2.6.0/bundler/gems/mumuki-domain-cb7a9018bb94/app/models/content.rb
mumuki-laboratory-7.7.0 vendor/bundle/ruby/2.6.0/bundler/gems/mumuki-domain-cb7a9018bb94/app/models/content.rb
mumuki-domain-7.7.0 app/models/content.rb
mumuki-domain-7.6.1 app/models/content.rb
mumuki-domain-7.6.0 app/models/content.rb
mumuki-laboratory-7.5.2 vendor/bundle/ruby/2.6.0/bundler/gems/mumuki-domain-ad16a5930cec/app/models/content.rb
mumuki-laboratory-7.5.1 vendor/bundle/ruby/2.3.0/bundler/gems/mumuki-domain-a059418e5fd8/app/models/content.rb