daily pastebin goal
74%
SHARE
TWEET

Untitled

a guest Sep 14th, 2018 60 Never
Upgrade to PRO!
ENDING IN00days00hours00mins00secs
  1. def habtm_checkboxes(obj, column, assignment_objects, assignment_object_display_column, label_css_class)
  2.     obj_to_s    = obj.class.to_s.split("::").last.underscore
  3.     field_name  = "#{obj_to_s}[#{column}][]"
  4.  
  5.     html = hidden_field_tag(field_name, "")
  6.     html += "\n"
  7.     assignment_objects.each do |assignment_obj|
  8.       cbx_id = "#{obj_to_s}_#{column}_#{assignment_obj.id}"
  9.       cbx = check_box_tag field_name, assignment_obj.id, obj.send(column).include?(assignment_obj.id), :id => cbx_id
  10.       html += label_tag cbx_id, h(assignment_obj.send(assignment_object_display_column)) + " " + h(cbx), :class => label_css_class + ' checkbox'
  11.       html += "\n"
  12.     end
  13.     html
  14.   end
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top