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
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
68 69 70 |
# File 'app/models/concerns/blacklight/document/active_model_shim.rb', line 68 def destroyed? false end |
#id ⇒ Object
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
76 77 78 |
# File 'app/models/concerns/blacklight/document/active_model_shim.rb', line 76 def marked_for_destruction? false end |
#new_record? ⇒ 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
64 65 66 |
# File 'app/models/concerns/blacklight/document/active_model_shim.rb', line 64 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..
83 84 85 |
# File 'app/models/concerns/blacklight/document/active_model_shim.rb', line 83 def to_partial_path 'catalog/document' end |