Lighthouse has a new layout. Prefer the old one? Return to the old layout, and switch back any time from the link at the top of each page.

This project is archived and is in readonly mode.

accepts_nested_attributes_for not working per docs

#3779

I am updating the Rails Guides and found that accepts_nested_attributes_for does not seem to be working per documentation.

On Rails master cloned and vendor'd as of 24 Jan, 2010, Ruby 1.8.7

The gist of the matter is at: http://gist.github.com/284996

accepts_nested_attributes does not seem to be working per docs on Rails 3. The following code snippets produce:

 undefined method `_delete' for #<Tag:0x1034414a8>

when you try and view a post that has a tag using the usual idiom:

  <div class="field">
    <%= tag_form.label :_delete, 'Remove:' %>
    <%= tag_form.check_box :_delete %>
  </div>

This does work as advertised on Rails 2.3.5

You can clone the whole Rails 3.0 app just waiting for your gem bundle at

github.com/mikel/getting-started-code

Assigning it to Jose because you touched the code last :)

Mikel

Reported by Mikel Lindsaar · January 24th, 2010 @ 04:46 AM

State: resolved
Milestone: 3.0.2
Assigned to: Mikel Lindsaar Mikel Lindsaar
Importance: High

Activity

  1. Mikel Lindsaar
    Mikel Lindsaar

    This was deprecated in 2.3.4 for destroy, confirmed that destory works and updated the docs. Jose will put the deprecation back in.

    January 24th, 2010 @ 08:32 AM

  2. Mikel Lindsaar
    Mikel Lindsaar
    • State changed from new to resolved

    Fixed documentation, was deprecated earlier. Closed

    January 24th, 2010 @ 09:48 AM

  3. Mikel Lindsaar
    Mikel Lindsaar
    • Assigned user changed from José Valim to Mikel Lindsaar

    January 24th, 2010 @ 09:48 AM

  4. drhenner (at yahoo)
    drhenner (at yahoo)
    • Importance changed from to High

    Just as an FYI: if you are using rails 3 use this:

    <%= tag_form.label :_destroy, 'Remove:' %>
    <%= tag_form.check_box :_delete %>
    

    August 15th, 2010 @ 10:38 PM

  5. Prashant
    Prashant

    destroy is working inplace of delete in rails 2.3.8

    August 16th, 2010 @ 09:08 AM

  6. Jeremy Kemper