Sha256: 1b59df2c11dfadea3326102271def5bbde6f57bcf3f2aa7373f42cfa2132acf8

Contents?: true

Size: 442 Bytes

Versions: 14

Compression:

Stored size: 442 Bytes

Contents

class Pulitzer::CreateSingletonPost
  attr_accessor :post_type_version, :title

  def initialize(post_type_version)
    self.post_type_version = post_type_version
    self.title = post_type_version.name
  end

  def call
    if post_type_version.singular? && !post_type_version.posts.any?
      singleton_post = post_type_version.posts.create(title: title)
      Pulitzer::CreatePostContentElements.new(singleton_post).call
    end
  end
end

Version data entries

14 entries across 13 versions & 1 rubygems

Version Path
pulitzer-0.15.12 app/interactions/pulitzer/create_singleton_post.rb
pulitzer-0.15.11 app/interactions/pulitzer/create_singleton_post.rb
pulitzer-0.15.10 app/interactions/pulitzer/create_singleton_post.rb
pulitzer-0.15.9 app/interactions/pulitzer/create_singleton_post.rb
pulitzer-0.15.8 app/interactions/pulitzer/create_singleton_post.rb
pulitzer-0.15.7 app/interactions/pulitzer/create_singleton_post.rb
pulitzer-0.15.6 app/interactions/pulitzer/create_singleton_post.rb
pulitzer-0.15.5 app/interactions/pulitzer/create_singleton_post.rb
pulitzer-0.15.4 app/interactions/pulitzer/create_singleton_post.rb
pulitzer-0.15.3 app/interactions/pulitzer/create_singleton_post.rb
pulitzer-0.15.2 app/interactions/pulitzer/create_singleton_post.rb
pulitzer-0.15.1 app/interactions/pulitzer/create_singleton_post.rb
pulitzer-0.15.0 app/interactions/pulitzer/create_singleton_post.rb
pulitzer-0.15.0 app/interactions/pulitzer/post_types_controller/create_singleton_post.rb