Sha256: 84fe356a061100d64e0c583c095d6cf19dd88993a57f413bdffb7b923f041842

Contents?: true

Size: 546 Bytes

Versions: 19

Compression:

Stored size: 546 Bytes

Contents

class Pulitzer::PostTypeVersionsController::ImportPost

  def initialize(post_type_version, params)
    @post_type_version, @params = post_type_version, params
  end

  def call
    import_json = @params[:import_json].read
    post = Pulitzer::Post.new
    post.from_json import_json
    post.post_type_version = @post_type_version
    if Pulitzer::Post.where(title: post.title).to_a.any?{|other_post|
      (other_post.post_type_version_id == post.post_type_version_id)}
      post.title += ' (cloned)'
    end
    post.save
    post
  end

end

Version data entries

19 entries across 19 versions & 1 rubygems

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