I ended up creating a custom form builder to expose the property directly
class FormBuilder < ActionView::Helpers::FormBuilder
def id_for(method, options={})
InstanceTag.new( object_name, method, self, object )
.id_for( options )
end
end
class InstanceTag < ActionView::Helpers::InstanceTag
def id_for( options )
add_default_name_and_id(options)
options['id']
end
end
Then set the default form builder
ActionView::Base.default_form_builder = FormBuilder
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…