Class: Hyrax::ResourceName
- 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.
Direct Known Subclasses
Instance Attribute Summary
Attributes inherited from Name
Instance Method Summary collapse
- #human ⇒ Object
-
#initialize(klass, namespace = nil, name = nil) ⇒ ResourceName
constructor
A new instance of ResourceName.
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 |
Instance Method Details
#human ⇒ Object
19 20 21 |
# File 'lib/hyrax/resource_name.rb', line 19 def human super.titleize end |