Module: SelectableAttrRails::Helpers::CheckBoxGroupHelper::Base

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

Instance Method Summary collapse

Instance Method Details

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



37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
# File 'lib/selectable_attr_rails/helpers/check_box_group_helper.rb', line 37

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