Sha256: f877d9603d4e01230250f65708ce62e6ecb60fd7a9d0c759b4b37dbda4eae8bb

Contents?: true

Size: 541 Bytes

Versions: 18

Compression:

Stored size: 541 Bytes

Contents

# -*- encoding : utf-8 -*-
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
    (super.constantize if defined?(super)) || default_document_type
  end
  
  def default_document_type
    SolrDocument
  end
  
end

Version data entries

18 entries across 18 versions & 1 rubygems

Version Path
blacklight-5.19.2 app/models/bookmark.rb
blacklight-5.19.1 app/models/bookmark.rb
blacklight-5.19.0 app/models/bookmark.rb
blacklight-5.18.0 app/models/bookmark.rb
blacklight-5.17.2 app/models/bookmark.rb
blacklight-5.17.1 app/models/bookmark.rb
blacklight-5.17.0 app/models/bookmark.rb
blacklight-5.16.4 app/models/bookmark.rb
blacklight-6.0.0.pre3 app/models/bookmark.rb
blacklight-5.16.3 app/models/bookmark.rb
blacklight-5.16.2 app/models/bookmark.rb
blacklight-5.16.1 app/models/bookmark.rb
blacklight-6.0.0.pre2 app/models/bookmark.rb
blacklight-6.0.0.pre1 app/models/bookmark.rb
blacklight-5.16.0 app/models/bookmark.rb
blacklight-5.15.0 app/models/bookmark.rb
blacklight-5.14.0 app/models/bookmark.rb
blacklight-5.13.1 app/models/bookmark.rb