Sha256: 83a35127ffa663da870ac9be687b0075738aebea1fc6c79f908034a61c271acc

Contents?: true

Size: 581 Bytes

Versions: 43

Compression:

Stored size: 581 Bytes

Contents

# frozen_string_literal: true
class Bookmark < ActiveRecord::Base
  
  belongs_to :user, polymorphic: true
  belongs_to :document, polymorphic: true

  validates :user_id, presence: true

  if Blacklight::Utils.needs_attr_accessible?
    attr_accessible :id, :document_id, :document_type, :title
  end

  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

43 entries across 43 versions & 1 rubygems

Version Path
blacklight-6.25.0 app/models/bookmark.rb
blacklight-6.24.0 app/models/bookmark.rb
blacklight-6.23.0 app/models/bookmark.rb
blacklight-6.22.0 app/models/bookmark.rb
blacklight-6.21.0 app/models/bookmark.rb
blacklight-6.20.0 app/models/bookmark.rb
blacklight-6.19.2 app/models/bookmark.rb
blacklight-6.19.1 app/models/bookmark.rb
blacklight-6.19.0 app/models/bookmark.rb
blacklight-6.18.0 app/models/bookmark.rb
blacklight-6.17.0 app/models/bookmark.rb
blacklight-6.16.0 app/models/bookmark.rb
blacklight-6.15.0 app/models/bookmark.rb
blacklight-6.14.1 app/models/bookmark.rb
blacklight-6.14.0 app/models/bookmark.rb
blacklight-6.13.0 app/models/bookmark.rb
blacklight-6.12.0 app/models/bookmark.rb
blacklight-6.11.2 app/models/bookmark.rb
blacklight-6.11.1 app/models/bookmark.rb
blacklight-6.11.0 app/models/bookmark.rb