GithubHelp home page GithubHelp logo

Comments (3)

activestylus avatar activestylus commented on May 24, 2024

On the previous lighthouse ticket, Josep M. Bach made the following comment:

February 27th, 2011 @ 02:01 PM
Seems that the builder doesn't know it's a one-to-many relationship or something like that, could it be?
In this particular line it checks for the [] naming after person[phones] - if it had found it, it would have triggered the #retrieve_auto_index method, which assigns an index ([0], [1]...). Sadly it matches nothing, so I'm guessing somewhere in the call stack it's not checking if person->phones is a 1-n relationship.

Any ideas?

from rails.

jdudek avatar jdudek commented on May 24, 2024

Why don't you add accepts_nested_attributes_for :phones to Person class? Then fields_for will add [0] to input names as you expect.

fields_for explicitly checks for existence of phones_attributes= method: https://github.com/rails/rails/blob/v3.0.7/actionpack/lib/action_view/helpers/form_helper.rb#L1159-1164

from rails.

activestylus avatar activestylus commented on May 24, 2024

cheers!

fwiw I had put the accepts_nested_attributes in there back in 3.0.5 and it didnt work, but apparently in 3.0.7 everything works as expected. Thanks again

from rails.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.