Sha256: b25493bb72f23e48991d33c7f58efbeb9c5af5e9b1913653ccdf45f23d97c986

Contents?: true

Size: 437 Bytes

Versions: 94

Compression:

Stored size: 437 Bytes

Contents

class Pulitzer::CreatePostTag

  def initialize(params)
    @request_params = params
  end

  def call
    label_id = post_tag_params[:label_id]
    unless (Integer(label_id) rescue false)
      tag = Pulitzer::Tag.where(name: label_id).first_or_create
      @request_params[:post_tag][:label_id] = tag.id
    end
    Pulitzer::PostTag.create post_tag_params
  end

  def post_tag_params
    @request_params[:post_tag].permit!
  end
end

Version data entries

94 entries across 94 versions & 1 rubygems

Version Path
pulitzer-0.12.4 app/interactions/pulitzer/create_post_tag.rb
pulitzer-0.12.3 app/interactions/pulitzer/create_post_tag.rb
pulitzer-0.12.2 app/interactions/pulitzer/create_post_tag.rb
pulitzer-0.12.1 app/interactions/pulitzer/create_post_tag.rb
pulitzer-0.12.0 app/interactions/pulitzer/create_post_tag.rb
pulitzer-0.11.3 app/interactions/pulitzer/create_post_tag.rb
pulitzer-0.11.2 app/interactions/pulitzer/create_post_tag.rb
pulitzer-0.11.1 app/interactions/pulitzer/create_post_tag.rb
pulitzer-0.11.0 app/interactions/pulitzer/create_post_tag.rb
pulitzer-0.10.3 app/interactions/pulitzer/create_post_tag.rb
pulitzer-0.10.2 app/interactions/pulitzer/create_post_tag.rb
pulitzer-0.10.1 app/interactions/pulitzer/create_post_tag.rb
pulitzer-0.10.0 app/interactions/pulitzer/create_post_tag.rb
pulitzer-0.5.14 app/interactions/pulitzer/create_post_tag.rb
pulitzer-0.5.13 app/interactions/pulitzer/create_post_tag.rb
pulitzer-0.5.11 app/interactions/pulitzer/create_post_tag.rb
pulitzer-0.5.10 app/interactions/pulitzer/create_post_tag.rb
pulitzer-0.5.9 app/interactions/pulitzer/create_post_tag.rb
pulitzer-0.5.8 app/interactions/pulitzer/create_post_tag.rb
pulitzer-0.5.7 app/interactions/pulitzer/create_post_tag.rb