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.

Fixed AR Nested Attributes Examples [doc]

#3247

I was unable to successfully create nested objects using the nested attributes examples found in ActiveRecord's nested_attributes.rb. Others in #rubyonrails @ freenode recreated the issue by following the examples listed in nested_attributes.rb.

I edited lines from the example section to match what worked properly when I tested creating new objects with _attributes in the parameters hash. Basically, it should be .create(:model_name) rather than *.create('model_name').

If the syntax I've used for the documentation is the intended format, please update the documentation to match. Else, we'll need to update the methods to handle strings instead of symbols in ActiveRecord's create method.

Hope this helps. Cheers.
john harris, jr.
git://github.com/jharris/rails.git

Reported by JohnHarrisJr. · September 22nd, 2009 @ 12:44 PM

State: stale
Milestone: none
Assigned to: nobody
Importance: none

Activity

  1. JohnHarrisJr.
    JohnHarrisJr.
    • Tag changed from nested attributes, patch to nested attributes, 2.3, 2.3.4, patch

    September 22nd, 2009 @ 07:37 PM

  2. JohnHarrisJr.
    JohnHarrisJr.
    • Tag changed from nested attributes, 2.3, 2.3.4, patch to nested attributes, 2.3.4, patch

    September 22nd, 2009 @ 07:37 PM

  3. Neeraj Singh
    Neeraj Singh
    • Importance changed from to

    Please go ahead and make the documentation change at http://github.com/lifo/docrails . Anyone can write so go ahead and push your changes.

    Once done please mark this ticket as done so that it could be closed. thanks.

    July 7th, 2010 @ 10:23 PM

  4. Eloy Duran
    Eloy Duran

    Actually, it's the first of the example line that's weird. Note that it's a symbol, but ends with an apostrophe: ‘params = { :member' => …’

    July 8th, 2010 @ 01:00 PM

  5. Santiago Pastorino
    Santiago Pastorino
    • State changed from new to open
    • Tag changed from nested attributes, 2.3.4, patch to nested attributes, 234, patch

    This issue has been automatically marked as stale because it has not been commented on for at least three months.

    The resources of the Rails core team are limited, and so we are asking for your help. If you can still reproduce this error on the 3-0-stable branch or on master, please reply with all of the information you have about it and add "[state:open]" to your comment. This will reopen the ticket for review. Likewise, if you feel that this is a very important feature for Rails to include, please reply with your explanation so we can consider it.

    Thank you for all your contributions, and we hope you will understand this step to focus our efforts where they are most helpful.

    February 2nd, 2011 @ 04:36 PM

  6. Santiago Pastorino
    Santiago Pastorino
    • State changed from open to stale

    February 2nd, 2011 @ 04:36 PM