Sha256: eb7765a9f8ec9016ae0f8ad4787dc87413e0587c23d07b4603f1965b8df18cd7

Contents?: true

Size: 455 Bytes

Versions: 74

Compression:

Stored size: 455 Bytes

Contents

# frozen_string_literal: true

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

  validates :user_id, presence: 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

74 entries across 74 versions & 2 rubygems

Version Path
blacklight-7.40.0 app/models/bookmark.rb
blacklight-7.39.0 app/models/bookmark.rb
blacklight-7.38.0 app/models/bookmark.rb
blacklight-spotlight-3.6.0.beta8 vendor/bundle/ruby/3.2.0/gems/blacklight-7.37.0/app/models/bookmark.rb
blacklight-7.37.0 app/models/bookmark.rb
blacklight-7.36.2 app/models/bookmark.rb
blacklight-7.36.1 app/models/bookmark.rb
blacklight-7.36.0 app/models/bookmark.rb
blacklight-7.35.0 app/models/bookmark.rb
blacklight-7.34.0 app/models/bookmark.rb
blacklight-7.33.1 app/models/bookmark.rb
blacklight-7.33.0 app/models/bookmark.rb
blacklight-7.32.0 app/models/bookmark.rb
blacklight-7.31.0 app/models/bookmark.rb
blacklight-7.30.0 app/models/bookmark.rb
blacklight-7.29.0 app/models/bookmark.rb
blacklight-7.28.0 app/models/bookmark.rb
blacklight-7.27.1 app/models/bookmark.rb
blacklight-7.27.0 app/models/bookmark.rb
blacklight-7.26.1 app/models/bookmark.rb