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



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

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

#_read_attribute(attr) ⇒ Object



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

def _read_attribute(attr)
  self[attr]
end

#destroyed?Boolean

Returns:

  • (Boolean)


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

def destroyed?
  false
end

#idObject

Unique ID for the document



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

def id
  self[self.class.unique_key]
end

#marked_for_destruction?Boolean

Returns:

  • (Boolean)


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

def marked_for_destruction?
  false
end

#new_record?Boolean

Returns:

  • (Boolean)


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

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)


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

def persisted?
  true
end

#to_partial_pathObject

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



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

def to_partial_path
  'catalog/document'
end