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