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.0.0.beta1 app/models/bookmark.rb