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
- #==(other) ⇒ Object
- #_read_attribute(attr) ⇒ Object
- #destroyed? ⇒ Boolean
-
#id ⇒ Object
Unique ID for the document.
- #marked_for_destruction? ⇒ Boolean
- #new_record? ⇒ Boolean
-
#persisted? ⇒ Boolean
ActiveRecord::Persistence method stubs to get non-AR objects to play nice with e.g.
-
#to_partial_path ⇒ Object
#to_partial_path is also defined in Blacklight::Document, but ActiveModel::Conversion (included above) will overwrite that..
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
58 59 60 |
# File 'app/models/concerns/blacklight/document/active_model_shim.rb', line 58 def destroyed? false end |
#id ⇒ Object
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
66 67 68 |
# File 'app/models/concerns/blacklight/document/active_model_shim.rb', line 66 def marked_for_destruction? false end |
#new_record? ⇒ 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
54 55 56 |
# File 'app/models/concerns/blacklight/document/active_model_shim.rb', line 54 def persisted? true end |
#to_partial_path ⇒ Object
#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 |