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



49
50
51
52
53
54
# File 'app/models/concerns/blacklight/document/active_model_shim.rb', line 49

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

#_read_attribute(attr) ⇒ Object



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

def _read_attribute(attr)
  self[attr]
end

#destroyed?Boolean

Returns:

  • (Boolean)


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

def destroyed?
  false
end

#idObject

Unique ID for the document



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

def id
  self[self.class.unique_key]
end

#marked_for_destruction?Boolean

Returns:

  • (Boolean)


75
76
77
# File 'app/models/concerns/blacklight/document/active_model_shim.rb', line 75

def marked_for_destruction?
  false
end

#new_record?Boolean

Returns:

  • (Boolean)


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

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)


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

def persisted?
  true
end

#to_partial_pathObject

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



82
83
84
# File 'app/models/concerns/blacklight/document/active_model_shim.rb', line 82

def to_partial_path
  'catalog/document'
end