Class: Hyrax::ResourceName

Inherits:
Name
  • Object
show all
Defined in:
lib/hyrax/resource_name.rb

Overview

A custom name for Valkyrie Resource objects. Route keys for resources may not be the same as the model name.

Instance Method Summary collapse

Constructor Details

#initialize(klass, namespace = nil, name = nil) ⇒ ResourceName

Returns a new instance of ResourceName.


8
9
10
11
12
13
14
15
16
17
# File 'lib/hyrax/resource_name.rb', line 8

def initialize(klass, namespace = nil, name = nil)
  super
  return unless defined?(Wings::ModelRegistry)

  legacy_model = Wings::ModelRegistry.lookup(klass)
  return unless legacy_model

  @route_key          = legacy_model.model_name.route_key
  @singular_route_key = legacy_model.model_name.singular_route_key
end