Sha256: 815588a0c9add8f67681baf1850e23aa79109dff235ca50396541c1d02e30349
Contents?: true
Size: 1.06 KB
Versions: 2
Compression:
Stored size: 1.06 KB
Contents
require 'active_model/conversion' module Blacklight::Document module ActiveModelShim extend ActiveSupport::Concern include ::ActiveModel::Conversion module ClassMethods def primary_key unique_key end def base_class self end end ## # Unique ID for the document def id self[self.class.unique_key] end ## # accessors for reading attribute def [] *args _source.send :[], *args end def _read_attribute(attr) self[attr] end def as_json(options = nil) _source.as_json(options) end ## # ActiveRecord::Persistence method stubs to get non-AR objects to # play nice with e.g. Blacklight's bookmarks def persisted? true end def destroyed? false end def new_record? false end ## # #to_partial_path is also defined in Blacklight::Document, but # ActiveModel::Conversion (included above) will overwrite that.. def to_partial_path 'catalog/document' end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
blacklight-5.13.0 | lib/blacklight/document/active_model_shim.rb |
blacklight-5.12.1 | lib/blacklight/document/active_model_shim.rb |