problem with super called from method defined with define_method
----------------------------------------------------------------

                 Key: JRUBY-3678
                 URL: http://jira.codehaus.org/browse/JRUBY-3678
             Project: JRuby
          Issue Type: Bug
    Affects Versions: JRuby 1.3RC1
            Reporter: Markus Bengts
            Assignee: Thomas E Enebo
             Fix For: JRuby 1.3


I have a custom form builder as subclass of ActionView::Helpers::FormBuilder, 
and it defines helpers that call super like this:

%w(text_field collection_select select password_field text_area 
file_field).each do |method_name|
  define_method(method_name) do |field_name, *args|
    form_row(label(field_name, *args) + super)
  end
end

Now if I call file_field in the beginning of a form then all subsequent calls 
to text_field return file fields. If I switch the order and call text_field in 
the beginning of the form then all subsequent calls to file_field return text 
fields.

If I write out all helpers separately like this:

def text_field(field_name, *args)
  form_row(label(field_name, *args) + super)
end
def file_field(field_name, *args)
  form_row(label(field_name, *args) + super)
end
# ...

then they work correctly.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: 
http://jira.codehaus.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email


Reply via email to