Sha256: 7e8f7432c4435dd61246ccda091f2ea7219961c988dfb4807cfda35ae9f52c75

Contents?: true

Size: 558 Bytes

Versions: 21

Compression:

Stored size: 558 Bytes

Contents

class Pulitzer::PostTypeVersionsController::Create

  def initialize(params, create_post=true)
    @params = params.to_h.to_hash.symbolize_keys
    @create_post = create_post
  end

  def call
    @ptv = Pulitzer::PostTypeVersion.new(@params)
    @post_type = @ptv.post_type
    last_version_number = @post_type.post_type_versions.maximum(:version_number) || 0
    this_version_number = last_version_number + 1
    @ptv.version_number = this_version_number
    @ptv.save
    ::Pulitzer::CreateSingletonPost.new(@ptv).call if @create_post
    @ptv
  end

end

Version data entries

21 entries across 21 versions & 1 rubygems

Version Path
pulitzer-0.15.31 app/interactions/pulitzer/post_type_versions_controller/create.rb
pulitzer-0.15.30 app/interactions/pulitzer/post_type_versions_controller/create.rb
pulitzer-0.15.29 app/interactions/pulitzer/post_type_versions_controller/create.rb
pulitzer-0.15.28 app/interactions/pulitzer/post_type_versions_controller/create.rb
pulitzer-0.15.27 app/interactions/pulitzer/post_type_versions_controller/create.rb
pulitzer-0.15.26 app/interactions/pulitzer/post_type_versions_controller/create.rb
pulitzer-0.15.25 app/interactions/pulitzer/post_type_versions_controller/create.rb
pulitzer-0.15.24 app/interactions/pulitzer/post_type_versions_controller/create.rb
pulitzer-0.15.23 app/interactions/pulitzer/post_type_versions_controller/create.rb
pulitzer-0.15.22 app/interactions/pulitzer/post_type_versions_controller/create.rb
pulitzer-0.15.21 app/interactions/pulitzer/post_type_versions_controller/create.rb
pulitzer-0.15.20 app/interactions/pulitzer/post_type_versions_controller/create.rb
pulitzer-0.15.19 app/interactions/pulitzer/post_type_versions_controller/create.rb
pulitzer-0.15.18 app/interactions/pulitzer/post_type_versions_controller/create.rb
pulitzer-0.15.17 app/interactions/pulitzer/post_type_versions_controller/create.rb
pulitzer-0.15.16 app/interactions/pulitzer/post_type_versions_controller/create.rb
pulitzer-0.15.15 app/interactions/pulitzer/post_type_versions_controller/create.rb
pulitzer-0.15.14 app/interactions/pulitzer/post_type_versions_controller/create.rb
pulitzer-0.15.13 app/interactions/pulitzer/post_type_versions_controller/create.rb
pulitzer-0.15.12 app/interactions/pulitzer/post_type_versions_controller/create.rb