Files
fizzy/app/models/comment/promptable.rb
T
Mike Dalessio 9bdc273c76 Prefer Account#slug to Account.script_name
Caching the script name in a class instance variable seemed like a bug
to me.
2025-08-09 14:27:41 -04:00

28 lines
640 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: #{collection_card_path(card.collection, card, anchor: ActionView::RecordIdentifier.dom_id(self), script_name: Account.sole.slug)}
END OF COMMENT #{id}
PROMPT
end
end