Class: Hyrax::Forms::BatchUploadForm::Name

Inherits:
ActiveModel::Name
  • Object
show all
Defined in:
app/forms/hyrax/forms/batch_upload_form.rb

Overview

A model name that provides correct routes for the BatchUploadController without changing the param key.

Example:

name = Name.new(GenericWork)
name.param_key
# => 'generic_work'
name.route_key
# => 'batch_uploads'

Instance Method Summary collapse

Constructor Details

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

Returns a new instance of Name.



60
61
62
63
64
65
# File 'app/forms/hyrax/forms/batch_upload_form.rb', line 60

def initialize(klass, namespace = nil, name = nil)
  super
  @route_key          = "batch_uploads"
  @singular_route_key = ActiveSupport::Inflector.singularize(@route_key)
  @route_key << "_index" if @plural == @singular
end