Module: Padrino::Helpers::FormHelpers::Options

Defined in:
padrino-helpers/lib/padrino-helpers/form_helpers/options.rb

Overview

Helpers to generate options list for select tag.

Instance Method Summary collapse

Instance Method Details

#extract_option_tags!(options) ⇒ Object



8
9
10
11
12
13
14
15
16
17
18
19
# File 'padrino-helpers/lib/padrino-helpers/form_helpers/options.rb', line 8

def extract_option_tags!(options)
  state = extract_option_state!(options)
  option_tags = if options[:grouped_options]
    grouped_options_for_select(options.delete(:grouped_options), state)
  else
    options_for_select(extract_option_items!(options), state)
  end
  if prompt = options.delete(:include_blank)
    option_tags.unshift(blank_option(prompt))
  end
  option_tags
end