Class: Hyrax::SolrDocumentBehavior::ModelWrapper

Inherits:
Object
  • Object
show all
Defined in:
app/models/concerns/hyrax/solr_document_behavior.rb

Instance Method Summary collapse

Constructor Details

#initialize(model, id) ⇒ ModelWrapper

Returns a new instance of ModelWrapper.



32
33
34
35
# File 'app/models/concerns/hyrax/solr_document_behavior.rb', line 32

def initialize(model, id)
  @model = model
  @id = id
end

Instance Method Details

#model_nameObject



45
46
47
# File 'app/models/concerns/hyrax/solr_document_behavior.rb', line 45

def model_name
  @model.model_name
end

#persisted?Boolean

Returns:

  • (Boolean)


37
38
39
# File 'app/models/concerns/hyrax/solr_document_behavior.rb', line 37

def persisted?
  true
end

#to_global_idObject



53
54
55
# File 'app/models/concerns/hyrax/solr_document_behavior.rb', line 53

def to_global_id
  URI::GID.build app: GlobalID.app, model_name: model_name.name, model_id: @id
end

#to_paramObject



41
42
43
# File 'app/models/concerns/hyrax/solr_document_behavior.rb', line 41

def to_param
  @id
end

#to_partial_pathObject



49
50
51
# File 'app/models/concerns/hyrax/solr_document_behavior.rb', line 49

def to_partial_path
  @model._to_partial_path
end