Class: RailsErrorDashboard::Commands::AddErrorComment
- Inherits:
-
Object
- Object
- RailsErrorDashboard::Commands::AddErrorComment
- Defined in:
- lib/rails_error_dashboard/commands/add_error_comment.rb
Overview
Command: Add a comment to an error This is a write operation that creates an ErrorComment record
Class Method Summary collapse
Instance Method Summary collapse
- #call ⇒ Object
-
#initialize(error_id, author_name, body) ⇒ AddErrorComment
constructor
A new instance of AddErrorComment.
Constructor Details
#initialize(error_id, author_name, body) ⇒ AddErrorComment
Returns a new instance of AddErrorComment.
12 13 14 15 16 |
# File 'lib/rails_error_dashboard/commands/add_error_comment.rb', line 12 def initialize(error_id, , body) @error_id = error_id @author_name = @body = body end |
Class Method Details
.call(error_id, author_name:, body:) ⇒ Object
8 9 10 |
# File 'lib/rails_error_dashboard/commands/add_error_comment.rb', line 8 def self.call(error_id, author_name:, body:) new(error_id, , body).call end |
Instance Method Details
#call ⇒ Object
18 19 20 21 22 23 24 25 |
# File 'lib/rails_error_dashboard/commands/add_error_comment.rb', line 18 def call error = ErrorLog.find(@error_id) error.comments.create!( author_name: @author_name, body: @body ) error end |