Patch #5416

Exclude "fields_for" from overridden methods in TabularFormBuilder

Added by Jean-Baptiste Barth over 7 years ago. Updated over 7 years ago.

Status:ClosedStart date:2010-04-30
Priority:LowDue date:
Assignee:Eric Davis% Done:

100%

Category:Code cleanup/refactoring
Target version:1.0.0 (RC)

Description

...since it's broken in some way in current implementation, and it's never called on the builder itself in Redmine core. It would be helpful to handle nested attributes in plugins.

To be clear, I'd like to be able to do something like this :

f.fields_for :association, MyAssociatedModel.new do ... end
or
f.fields_for :association, @main_object.my_associated_models do ... end

...where "f" is a standard TabularFormBuilder.

But it's broken in current implementation since method is overridden with a different signature than its parent : fields_for(field, options={}) VS fields_for(record_or_name_or_array, *args, &block).

Patch attached, no test broken on my platform with current trunk (r3704). I can give a more detailed example if needed.

tabular_fields_for.diff Magnifier (547 Bytes) Jean-Baptiste Barth, 2010-04-30 14:50

Associated revisions

Revision 3804
Added by Eric Davis over 7 years ago

Exclude fields_for in the TabularFormBuilder, it has a different method
signature. #5416

Contributed by Jean-Baptiste Barth

History

#1 Updated by Eric Davis over 7 years ago

  • Status changed from New to Closed
  • Assignee set to Eric Davis
  • Target version set to 1.0.0 (RC)
  • % Done changed from 0 to 100

Added in r3804, thank you for your contribution.

Also available in: Atom PDF