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
Defined Under Namespace
Modules: ClassMethods
Instance Method Summary collapse
-
#[](*args) ⇒ Object
accessors for reading attribute.
- #_read_attribute(attr) ⇒ Object
- #as_json(options = nil) ⇒ 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
#[](*args) ⇒ Object
accessors for reading attribute
41 42 43 |
# File 'app/models/concerns/blacklight/document/active_model_shim.rb', line 41 def [] *args _source.send :[], *args end |
#_read_attribute(attr) ⇒ Object
45 46 47 |
# File 'app/models/concerns/blacklight/document/active_model_shim.rb', line 45 def _read_attribute(attr) self[attr] end |
#as_json(options = nil) ⇒ Object
49 50 51 |
# File 'app/models/concerns/blacklight/document/active_model_shim.rb', line 49 def as_json( = nil) _source.as_json() end |
#destroyed? ⇒ Boolean
60 61 62 |
# File 'app/models/concerns/blacklight/document/active_model_shim.rb', line 60 def destroyed? false end |
#id ⇒ Object
Unique ID for the document
35 36 37 |
# File 'app/models/concerns/blacklight/document/active_model_shim.rb', line 35 def id self[self.class.unique_key] end |
#marked_for_destruction? ⇒ Boolean
68 69 70 |
# File 'app/models/concerns/blacklight/document/active_model_shim.rb', line 68 def marked_for_destruction? false end |
#new_record? ⇒ Boolean
64 65 66 |
# File 'app/models/concerns/blacklight/document/active_model_shim.rb', line 64 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
56 57 58 |
# File 'app/models/concerns/blacklight/document/active_model_shim.rb', line 56 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..
75 76 77 |
# File 'app/models/concerns/blacklight/document/active_model_shim.rb', line 75 def to_partial_path 'catalog/document' end |