I am trying to DRY up a bunch of forms code that has a repeating set of fields appearing at the end of each form. I wrote a helper that wraps around the form_for rails helpe
pretty sure this would work
def simple_form_helper(record_or_name_or_array, *args)
options = ... # overriding some options, not relevant
form_for(record_or_name_or_array, *(args << options.merge(:option => "blah"))) do |f|
yield f if block_given?
concat f.text_field :foo
concat f.hidden_field :bar
concat f.submit "Save"
end
end
and you can also call simple_form_helper :object without a block if you don't need to add any fields