Method: ActionView::Helpers::Tags::CheckBox#render

Defined in:
actionview/lib/action_view/helpers/tags/check_box.rb

#renderObject



17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
# File 'actionview/lib/action_view/helpers/tags/check_box.rb', line 17

def render
  options = @options.stringify_keys
  options["type"]     = "checkbox"
  options["value"]    = @checked_value
  options["checked"] = "checked" if input_checked?(options)

  if options["multiple"]
    add_default_name_and_id_for_value(@checked_value, options)
    options.delete("multiple")
  else
    add_default_name_and_id(options)
  end

  include_hidden = options.delete("include_hidden") { true }
  checkbox = tag("input", options)

  if include_hidden
    hidden = hidden_field_for_checkbox(options)
    hidden + checkbox
  else
    checkbox
  end
end