All pastes #59507 Raw Edit

Miscellany

public text v1 · immutable
#59507 ·published 2006-05-29 05:32 UTC
rendered paste body
<% form_for :listing, @listing, :builder => LabellingFormBuilder do |f| %>
<%= f.select #???? OH NOEZ IT WANTS 2 ARGUMENTS, but i want to give it 4 %>

class LabellingFormBuilder < ActionView::Helpers::FormBuilder
  (field_helpers - %w(check_box radio_button hidden_field)).each do |selector| 
      src = <<-END_SRC      def #{selector}(field, options = {}) 
          @template.content_tag("div", 
            @template.content_tag("label", options[:custom_text] || field.to_s.humanize + ":",
             {:for => object_name.to_s+'_'+field.to_s}) + 
              super)
      end
      END_SRC
      class_eval src, __FILE__, __LINE__ 
  end 
end