Module: SelectableAttrRails::Helpers::RadioButtonGroupHelper::Base

Defined in:
lib/selectable_attr_rails/helpers/radio_button_group_helper.rb

Instance Method Summary collapse

Instance Method Details

#radio_button_group(object_name, method, options = nil, &block) ⇒ Object



31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
# File 'lib/selectable_attr_rails/helpers/radio_button_group_helper.rb', line 31

def radio_button_group(object_name, method, options = nil, &block)
  object = (options || {})[:object] || instance_variable_get("@#{object_name}")
  builder = Builder.new(object, object_name, method, options, self)
  if block_given?
    yield(builder)
    return nil
  else
    result = ''
    builder.each do
      result << builder.radio_button
      result << builder.label
    end
    return result
  end
end