implicit argument passing of super from method defined by define_method() is not supported. Specify

Posted by jaycode on Stack Overflow See other posts from Stack Overflow or by jaycode
Published on 2010-04-03T19:02:50Z Indexed on 2010/04/03 19:13 UTC
Read the original article Hit count: 426

Most of you should already know Pragmatic book's "Agile web dev with rails" (third edition). On page 537 - 541 it has "Custom Form Builders" code as follows:

  class TaggedBuilder < ActionView::Helpers::FormBuilder
    # <p> # <label for="product_description">Description</label><br/> # <%= form.text_area 'description' %> #</p>
    def self.create_tagged_field(method_name) 
      define_method(method_name) do |label, *args|
        @template.content_tag("p" , @template.content_tag("label" , label.to_s.humanize, 
        :for => "#{@object_name}_#{label}") + "<br/>" + super)
      end
    end
    field_helpers.each do |name| 
      create_tagged_field(name)
    end 
  end

This code doesn't work with Ruby 1.9.1. It returns error as follows:

implicit argument passing of super from method defined by define_method() is not supported. Specify all arguments explicitly. (ActionView::TemplateError)

My question is: What should I change in the code to fix this?

Thank you

© Stack Overflow or respective owner

Related posts about ruby-on-rails

Related posts about ruby