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



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

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

#_read_attribute(attr) ⇒ Object



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

def _read_attribute(attr)
  self[attr]
end

#destroyed?Boolean

Returns:

  • (Boolean)


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

def destroyed?
  false
end

#idObject

Unique ID for the document



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

def id
  self[self.class.unique_key]
end

#marked_for_destruction?Boolean

Returns:

  • (Boolean)


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

def marked_for_destruction?
  false
end

#new_record?Boolean

Returns:

  • (Boolean)


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

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)


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

def persisted?
  true
end

#to_partial_pathObject

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



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

def to_partial_path
  'catalog/document'
end