Skip to content

Commit

Permalink
Added UID that is generated based on the title
Browse files Browse the repository at this point in the history
  • Loading branch information
brand-it committed Apr 27, 2023
1 parent ff252a6 commit 7a36871
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 2 deletions.
2 changes: 1 addition & 1 deletion bin/rails
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ end
if items.empty?
items = search.versions.map do |version|
{
uid: search.uid,
uid: SecureRandom.uuid,
type: 'default',
arg: query,
subtitle: "Search #{version} #{search.query}",
Expand Down
2 changes: 1 addition & 1 deletion lib/file_cache.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@
class FileCache
class Error < StandardError; end

VERSION = '1'.freeze
CACHE_DIR = "#{ENV['TMPDIR'] || ENV['TMP'] || ENV['TEMP']}ruby_and_rails_api_docs_#{VERSION}".freeze
MAX_EXPIRES_IN = 60 * 60 * 24 * 30 # 1 month
VERSION = '1'.freeze

attr_reader :key, :expires_in, :compress, :dir_path

Expand Down
4 changes: 4 additions & 0 deletions lib/rails_search_doc.rb
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,10 @@ def title
"v#{version} #{klass}"
end

def uid
Base64.encode64(title).strip
end

def description
self[:description].gsub!(/<\S+>/, '')
presence(self[:description])
Expand Down

0 comments on commit 7a36871

Please sign in to comment.