Module: RailsCoreExtensions::HasManyExtensions::FormBuilder

Defined in:
lib/rails_core_extensions/action_view_has_many_extensions.rb

Instance Method Summary collapse

Instance Method Details

#hm_check_box(method, object, options = {}) ⇒ Object



23
24
25
26
# File 'lib/rails_core_extensions/action_view_has_many_extensions.rb', line 23

def hm_check_box(method, object, options = {})
  empty = (hm_empty_array(method) unless @habtm_fields && @habtm_fields[method])
  (empty || '').html_safe + @template.hm_check_box(@object_name, method, options.merge(:object => object, :parent => @object, :objects => @habtm_fields[method]))
end

#hm_empty_array(method) ⇒ Object



17
18
19
20
21
# File 'lib/rails_core_extensions/action_view_has_many_extensions.rb', line 17

def hm_empty_array(method)
  @habtm_fields ||= {}
  @habtm_fields[method] = @object.send(method)
  @template.hm_empty_array(@object_name, method)
end