Module: Blacklight::Document::ActiveModelShim

Extended by:
ActiveSupport::Concern
Includes:
ActiveModel::Conversion
Included in:
Solr::Document
Defined in:
app/models/concerns/blacklight/document/active_model_shim.rb

Instance Method Summary collapse

Instance Method Details

#==(other) ⇒ Object



40
41
42
43
44
45
# File 'app/models/concerns/blacklight/document/active_model_shim.rb', line 40

def ==(other)
  super ||
    (other.instance_of?(self.class) &&
      id &&
      other.id == id)
end

#_read_attribute(attr) ⇒ Object



47
48
49
# File 'app/models/concerns/blacklight/document/active_model_shim.rb', line 47

def _read_attribute(attr)
  self[attr]
end

#destroyed?Boolean

Returns:

  • (Boolean)


58
59
60
# File 'app/models/concerns/blacklight/document/active_model_shim.rb', line 58

def destroyed?
  false
end

#idObject

Unique ID for the document



36
37
38
# File 'app/models/concerns/blacklight/document/active_model_shim.rb', line 36

def id
  self[self.class.unique_key]
end

#marked_for_destruction?Boolean

Returns:

  • (Boolean)


66
67
68
# File 'app/models/concerns/blacklight/document/active_model_shim.rb', line 66

def marked_for_destruction?
  false
end

#new_record?Boolean

Returns:

  • (Boolean)


62
63
64
# File 'app/models/concerns/blacklight/document/active_model_shim.rb', line 62

def new_record?
  false
end

#persisted?Boolean

ActiveRecord::Persistence method stubs to get non-AR objects to play nice with e.g. Blacklight’s bookmarks

Returns:

  • (Boolean)


54
55
56
# File 'app/models/concerns/blacklight/document/active_model_shim.rb', line 54

def persisted?
  true
end

#to_partial_pathObject

#to_partial_path is also defined in Blacklight::Document, but ActiveModel::Conversion (included above) will overwrite that..



73
74
75
# File 'app/models/concerns/blacklight/document/active_model_shim.rb', line 73

def to_partial_path
  'catalog/document'
end