This project is archived and is in readonly mode.

#4551 ✓committed
wildchild

Add an option to omit the creation of hidden field with object id when using fields_for

Reported by wildchild | May 7th, 2010 @ 06:45 PM | in 3.x

Some so called "ORMs" (CouchRest for example) allow to create inline associations, in this case associated objects does not have its own IDs. An option to omit the creation of hidden field with associated object id would be useful.

Usage:


  # Disable hidden id field
  form_for(@post, :include_id => false) do |f|
    f.text_field :title
    f.fields_for(:comments) do |cf|
      cf.text_field :title

      # Emit ids again
      cf.fields_for(:author, :include_id => true) do |af|
        af.text_field :name
      end
    end
  end

UPDATE: include_id_reworked.patch

Comments and changes to this ticket

Create your profile

Help contribute to this project by taking a few moments to create your personal profile. Create your profile »

<h2 style="font-size: 14px">Tickets have moved to Github</h2>

The new ticket tracker is available at <a href="https://github.com/rails/rails/issues">https://github.com/rails/rails/issues</a>