Sha256: da0e80d4959a89e8903efeb75a5ea554cdde59feac842bd5077c41c5fb246b5d

Contents?: true

Size: 533 Bytes

Versions: 21

Compression:

Stored size: 533 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
  attr_accessible :id, :document_id, :document_type, :title if Rails::VERSION::MAJOR < 4

  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

21 entries across 21 versions & 1 rubygems

Version Path
blacklight-5.10.2 app/models/bookmark.rb
blacklight-5.10.1 app/models/bookmark.rb
blacklight-5.10.0 app/models/bookmark.rb
blacklight-5.9.3 app/models/bookmark.rb
blacklight-5.9.2 app/models/bookmark.rb
blacklight-5.9.1 app/models/bookmark.rb
blacklight-5.9.0 app/models/bookmark.rb
blacklight-5.8.2 app/models/bookmark.rb
blacklight-5.8.1 app/models/bookmark.rb
blacklight-5.8.0 app/models/bookmark.rb
blacklight-5.7.2 app/models/bookmark.rb
blacklight-5.5.4 app/models/bookmark.rb
blacklight-5.7.1 app/models/bookmark.rb
blacklight-5.7.0 app/models/bookmark.rb
blacklight-5.6.0 app/models/bookmark.rb
blacklight-5.5.3 app/models/bookmark.rb
blacklight-5.5.2 app/models/bookmark.rb
blacklight-5.5.1 app/models/bookmark.rb
blacklight-5.5.0 app/models/bookmark.rb
blacklight-5.4.0 app/models/bookmark.rb