Sha256: 97c529fa0768f93a34e0a7226405de3f292385f38fb6d77c8ffccc54c8c6da32

Contents?: true

Size: 417 Bytes

Versions: 21

Compression:

Stored size: 417 Bytes

Contents

# frozen_string_literal: true

class Bookmark < ApplicationRecord
  belongs_to :user, polymorphic: true
  belongs_to :document, polymorphic: true

  def document
    document_type.new document_type.unique_key => document_id
  end

  def document_type
    value = super if defined?(super)
    value &&= value.constantize
    value || default_document_type
  end

  def default_document_type
    SolrDocument
  end
end

Version data entries

21 entries across 21 versions & 2 rubygems

Version Path
blacklight-8.6.1 app/models/bookmark.rb
blacklight-8.6.0 app/models/bookmark.rb
blacklight-8.5.1 app/models/bookmark.rb
blacklight-8.5.0 app/models/bookmark.rb
blacklight-8.4.0 app/models/bookmark.rb
blacklight-spotlight-3.6.0.beta8 vendor/bundle/ruby/3.2.0/gems/blacklight-8.3.0/app/models/bookmark.rb
blacklight-8.3.0 app/models/bookmark.rb
blacklight-8.2.2 app/models/bookmark.rb
blacklight-8.2.1 app/models/bookmark.rb
blacklight-8.2.0 app/models/bookmark.rb
blacklight-8.1.0 app/models/bookmark.rb
blacklight-8.0.1 app/models/bookmark.rb
blacklight-8.0.0 app/models/bookmark.rb
blacklight-8.0.0.beta8 app/models/bookmark.rb
blacklight-8.0.0.beta7 app/models/bookmark.rb
blacklight-8.0.0.beta6 app/models/bookmark.rb
blacklight-8.0.0.beta5 app/models/bookmark.rb
blacklight-8.0.0.beta4 app/models/bookmark.rb
blacklight-8.0.0.beta3 app/models/bookmark.rb
blacklight-8.0.0.beta2 app/models/bookmark.rb