Files
fizzy/app/models/comment/promptable.rb
T
Jorge Manrubia 4e72566856 Flatten card resource
We only need the parent collection for creating cards. Carrying it in the
rest of actions is a hassle.
2025-09-10 11:24:23 +02:00

28 lines
612 B
Ruby

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