This project is archived and is in readonly mode.

#3247 ✓stale
JohnHarrisJr.

Fixed AR Nested Attributes Examples [doc]

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

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

Comments and changes to this ticket

  • JohnHarrisJr.

    JohnHarrisJr. September 22nd, 2009 @ 07:37 PM

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

    JohnHarrisJr. September 22nd, 2009 @ 07:37 PM

    • Tag changed from nested attributes, 2.3, 2.3.4, patch to nested attributes, 2.3.4, patch
  • Neeraj Singh

    Neeraj Singh July 7th, 2010 @ 10:23 PM

    • 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.

  • Eloy Duran

    Eloy Duran July 8th, 2010 @ 01:00 PM

    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' => …’

  • Santiago Pastorino

    Santiago Pastorino February 2nd, 2011 @ 04:36 PM

    • 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.

  • Santiago Pastorino

    Santiago Pastorino February 2nd, 2011 @ 04:36 PM

    • State changed from “open” to “stale”

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>

Attachments

Pages