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