Class: Uchi::Field::Select::Edit

Inherits:
Base::Edit show all
Defined in:
app/components/uchi/field/select.rb

Instance Attribute Summary

Attributes inherited from Base::Edit

#form, #hint, #label

Attributes inherited from Base::Component

#field, #record, #repository

Instance Method Summary collapse

Methods inherited from Base::Edit

#initialize

Methods inherited from Base::Component

#initialize, #value

Constructor Details

This class inherits a constructor from Uchi::Field::Base::Edit

Instance Method Details

#collectionObject



7
8
9
10
11
12
13
# File 'app/components/uchi/field/select.rb', line 7

def collection
  if field.grouped?
    field.options.map { |group, group_options| [group, group_options.map { |value, label| [label, value] }] }
  else
    field.flat_options.map { |value, label| [label, value] }
  end
end