Class: Sufia::Forms::AdminSetForm

Inherits:
CurationConcerns::Forms::CollectionEditForm
  • Object
show all
Defined in:
app/forms/sufia/forms/admin_set_form.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.multiple?(_term) ⇒ Boolean

This determines whether the allowed parameters are single or multiple. By default it delegates to the model.

Returns:

  • (Boolean)


16
17
18
# File 'app/forms/sufia/forms/admin_set_form.rb', line 16

def multiple?(_term)
  false
end

.sanitize_params(form_params) ⇒ Object

Overriden to cast ‘title’ and ‘description’ to an array



21
22
23
24
25
26
# File 'app/forms/sufia/forms/admin_set_form.rb', line 21

def sanitize_params(form_params)
  super.tap do |params|
    params['title'] = Array.wrap(params['title']) if params.key?('title')
    params['description'] = Array.wrap(params['description']) if params.key?('description')
  end
end

Instance Method Details

#[](key) ⇒ Object

Cast any array values on the model to scalars.



8
9
10
11
# File 'app/forms/sufia/forms/admin_set_form.rb', line 8

def [](key)
  return super if key == :thumbnail_id
  super.first
end