Sha256: 87a0b249a412853f592561e2649330e988c49a4ec2388b4e3b5816d2d0096d56

Contents?: true

Size: 463 Bytes

Versions: 31

Compression:

Stored size: 463 Bytes

Contents

class Pulitzer::PostTypesController::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

31 entries across 31 versions & 1 rubygems

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