Class: Pinnable::AddComment

Inherits:
Object
  • Object
show all
Defined in:
app/services/pinnable/add_comment.rb

Overview

Appends a reply to a pin, stamping the author’s display label like CapturePin does.

Instance Method Summary collapse

Constructor Details

#initialize(pin:, author:, params:) ⇒ AddComment

Returns a new instance of AddComment.



4
5
6
7
8
# File 'app/services/pinnable/add_comment.rb', line 4

def initialize(pin:, author:, params:)
  @pin = pin
  @author = author
  @params = params
end

Instance Method Details

#callObject



10
11
12
13
14
15
16
# File 'app/services/pinnable/add_comment.rb', line 10

def call
  pin.comments.create!(
    author:,
    author_label: Pinnable.config.user_label.call(author),
    body: params[:body]
  )
end