Merge pull request #878 from basecamp/flavorjones/account-slug

Prefer Account#slug to Account.script_name
This commit is contained in:
Mike Dalessio
2025-08-09 14:30:25 -04:00
committed by GitHub
4 changed files with 8 additions and 6 deletions
+2 -4
View File
@@ -3,10 +3,8 @@ class Account < ApplicationRecord
has_many_attached :uploads
class << self
def script_name
@script_name ||= "/#{sole.queenbee_id}"
end
def slug
"/#{queenbee_id}"
end
def setup_basic_template
+1 -1
View File
@@ -29,7 +29,7 @@ module Card::Promptable
* Collection id: #{collection_id}
* Collection name: #{collection.name}
* Number of comments: #{comments.count}
* Path: #{collection_card_path(collection, self, script_name: Account.script_name)}
* Path: #{collection_card_path(collection, self, script_name: Account.sole.slug)}
#{comments.last(MAX_COMMENTS).collect(&:to_prompt).join("\n")}
END OF CARD #{id}
+1 -1
View File
@@ -20,7 +20,7 @@ module Comment::Promptable
* 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)}
* Path: #{collection_card_path(card.collection, card, anchor: ActionView::RecordIdentifier.dom_id(self), script_name: Account.sole.slug)}
END OF COMMENT #{id}
PROMPT
end
+4
View File
@@ -1,4 +1,8 @@
require "test_helper"
class AccountTest < ActiveSupport::TestCase
test "slug" do
account = Account.sole
assert_equal "/#{account.queenbee_id}", account.slug
end
end