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.31 app/interactions/pulitzer/post_types_controller/create_singleton_post.rb
pulitzer-0.15.30 app/interactions/pulitzer/post_types_controller/create_singleton_post.rb
pulitzer-0.15.29 app/interactions/pulitzer/post_types_controller/create_singleton_post.rb
pulitzer-0.15.28 app/interactions/pulitzer/post_types_controller/create_singleton_post.rb
pulitzer-0.15.27 app/interactions/pulitzer/post_types_controller/create_singleton_post.rb
pulitzer-0.15.26 app/interactions/pulitzer/post_types_controller/create_singleton_post.rb
pulitzer-0.15.25 app/interactions/pulitzer/post_types_controller/create_singleton_post.rb
pulitzer-0.15.24 app/interactions/pulitzer/post_types_controller/create_singleton_post.rb
pulitzer-0.15.23 app/interactions/pulitzer/post_types_controller/create_singleton_post.rb
pulitzer-0.15.22 app/interactions/pulitzer/post_types_controller/create_singleton_post.rb
pulitzer-0.15.21 app/interactions/pulitzer/post_types_controller/create_singleton_post.rb
pulitzer-0.15.20 app/interactions/pulitzer/post_types_controller/create_singleton_post.rb
pulitzer-0.15.19 app/interactions/pulitzer/post_types_controller/create_singleton_post.rb
pulitzer-0.15.18 app/interactions/pulitzer/post_types_controller/create_singleton_post.rb
pulitzer-0.15.17 app/interactions/pulitzer/post_types_controller/create_singleton_post.rb
pulitzer-0.15.16 app/interactions/pulitzer/post_types_controller/create_singleton_post.rb
pulitzer-0.15.15 app/interactions/pulitzer/post_types_controller/create_singleton_post.rb
pulitzer-0.15.14 app/interactions/pulitzer/post_types_controller/create_singleton_post.rb
pulitzer-0.15.13 app/interactions/pulitzer/post_types_controller/create_singleton_post.rb
pulitzer-0.15.12 app/interactions/pulitzer/post_types_controller/create_singleton_post.rb