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.


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

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

Instance Method Details

#model_nameObject


43
44
45
# File 'app/models/concerns/hyrax/solr_document_behavior.rb', line 43

def model_name
  @model.model_name
end

#persisted?Boolean

Returns:

  • (Boolean)

35
36
37
# File 'app/models/concerns/hyrax/solr_document_behavior.rb', line 35

def persisted?
  true
end

#to_global_idObject


51
52
53
# File 'app/models/concerns/hyrax/solr_document_behavior.rb', line 51

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

#to_paramObject


39
40
41
# File 'app/models/concerns/hyrax/solr_document_behavior.rb', line 39

def to_param
  @id
end

#to_partial_pathObject


47
48
49
# File 'app/models/concerns/hyrax/solr_document_behavior.rb', line 47

def to_partial_path
  @model._to_partial_path
end