Files
fizzy/app/models/comment/promptable.rb
T
Jorge Manrubia 8bb7783215 Extract "prompt generation" logic to models for events, comments and cards
So that we can reuse in other scenarios
2025-07-24 16:48:03 +02:00

27 lines
596 B
Ruby

module Comment::Promptable
extend ActiveSupport::Concern
included do
include Rails.application.routes.url_helpers
end
def to_prompt
<<~PROMPT
### Comment #{id}
**Content:**
#{body.to_plain_text}
#### Metadata
* Id: #{id}
* Card id: #{card.id}
* Card title: #{card.title}
* Created by: #{creator.name}}
* Created at: #{created_at}}
* Path: #{collection_card_path(card.collection, card, anchor: ActionView::RecordIdentifier.dom_id(self), script_name: Account.script_name)}
PROMPT
end
end