Sha256: 208c3a58e0d1c167b5f857e6d04db97ef220b615c309b28bd78bc695a7652eba

Contents?: true

Size: 559 Bytes

Versions: 9

Compression:

Stored size: 559 Bytes

Contents

# -*- encoding : utf-8 -*-
class Bookmark < ActiveRecord::Base
  
  belongs_to :user, polymorphic: true
  belongs_to :document, polymorphic: true

  validates_presence_of :user_id, :scope=>:document_id

  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

9 entries across 9 versions & 1 rubygems

Version Path
blacklight-5.13.0 app/models/bookmark.rb
blacklight-5.11.3 app/models/bookmark.rb
blacklight-5.12.1 app/models/bookmark.rb
blacklight-5.12.0 app/models/bookmark.rb
blacklight-5.10.3 app/models/bookmark.rb
blacklight-5.9.4 app/models/bookmark.rb
blacklight-5.11.2 app/models/bookmark.rb
blacklight-5.11.1 app/models/bookmark.rb
blacklight-5.11.0 app/models/bookmark.rb