Class: Pulitzer::CreatePostTag

Inherits:
Object
  • Object
show all
Defined in:
app/interactions/pulitzer/create_post_tag.rb

Instance Method Summary collapse

Constructor Details

#initialize(params) ⇒ CreatePostTag

Returns a new instance of CreatePostTag.



3
4
5
# File 'app/interactions/pulitzer/create_post_tag.rb', line 3

def initialize(params)
  @request_params = params
end

Instance Method Details

#callObject



7
8
9
10
11
12
13
14
# File 'app/interactions/pulitzer/create_post_tag.rb', line 7

def call
  label_id = [: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 
end

#post_tag_paramsObject



16
17
18
# File 'app/interactions/pulitzer/create_post_tag.rb', line 16

def 
  @request_params[:post_tag].permit!
end