Class: CurationConcerns::SolrDocumentBehavior::ModelWrapper

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

Instance Method Summary collapse

Constructor Details

#initialize(model, id) ⇒ ModelWrapper

Returns a new instance of ModelWrapper.



21
22
23
24
# File 'app/models/concerns/curation_concerns/solr_document_behavior.rb', line 21

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

Instance Method Details

#model_nameObject



34
35
36
# File 'app/models/concerns/curation_concerns/solr_document_behavior.rb', line 34

def model_name
  @model.model_name
end

#persisted?Boolean

Returns:

  • (Boolean)


26
27
28
# File 'app/models/concerns/curation_concerns/solr_document_behavior.rb', line 26

def persisted?
  true
end

#to_global_idObject



42
43
44
# File 'app/models/concerns/curation_concerns/solr_document_behavior.rb', line 42

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

#to_paramObject



30
31
32
# File 'app/models/concerns/curation_concerns/solr_document_behavior.rb', line 30

def to_param
  @id
end

#to_partial_pathObject



38
39
40
# File 'app/models/concerns/curation_concerns/solr_document_behavior.rb', line 38

def to_partial_path
  @model._to_partial_path
end