Giter Site home page Giter Site logo

Order of create? about nested_form HOT 10 CLOSED

ryanb avatar ryanb commented on July 30, 2024
Order of create?

from nested_form.

Comments (10)

ryanb avatar ryanb commented on July 30, 2024

Hmm, I thought since it uses the current time as a creation id it would build them in that order, but I guess not. Time to investigate.

from nested_form.

dazoo avatar dazoo commented on July 30, 2024

Are you experiencing this problem as well? Or did I do something wrong on my part?

from nested_form.

ryanb avatar ryanb commented on July 30, 2024

I haven't seen this behavior in the nested_form branch of the complex-form-examples project, but I haven't tested it extensively. You may want to check that out and see if you get the same behavior.

from nested_form.

nathanborgo avatar nathanborgo commented on July 30, 2024

I'm having the same problem. To reproduce:

  • Build 2 child objects in the controller
  • Don't fill the parent form out (to trigger a validation error)
  • Fill the child forms out
  • Add another child object through the link_to_add
  • Fill it out
  • Repeat that until you have 6 child objects
  • Submit
  • The child forms are now out of order (in my case: 1, 6, 3, 5, 4, 2) an no longer use the current time.

When creating the new child forms, they do use the current time. If you inspect a field after the validation error, though, they all reset to 0-5, in the wrong order. If you do the same thing, but building 1 child object in the controller instead of 2, it works fine.

Hopefully that helps.

from nested_form.

ryanb avatar ryanb commented on July 30, 2024

@subtractiv thanks for the detailed response. This may be an issue with how nested attributes works in Rails, but I'll research it and see if there's a way to fix it here. If someone has ideas please submit a pull request.

from nested_form.

dmilisic avatar dmilisic commented on July 30, 2024

I can confirm this issue. However, before I used an old version where new nested fields didn't have "new_" prefix and it worked fine (I used it with up to 100 new records and the order was always the same as entered).

Could this "new_" prefix be removed? Or is it risky that new id would match existing?

from nested_form.

hakjune avatar hakjune commented on July 30, 2024

This problem still persists.
timestamp is used when we add new sub item in nested model but it's saved in wrong order, which should have been ordered by time.

"1333432769586"=>{"partnercomment"=>"6", "expenditure"=>"", "status"=>"1", "_destroy"=>"false", "id"=>"", "time4"=>"0", "time3"=>"0", "time2"=>"0", "time1"=>"0"},
"1333432776523"=>{"partnercomment"=>"13", "expenditure"=>"", "status"=>"1", "_destroy"=>"false", "id"=>"", "time4"=>"0", "time3"=>"0", "time2"=>"0", "time1"=>"0"},
"1333432773627"=>{"partnercomment"=>"10", "expenditure"=>"", "status"=>"1", "_destroy"=>"false", "id"=>"", "time4"=>"0", "time3"=>"0", "time2"=>"0", "time1"=>"0"},
"1333432772523"=>{"partnercomment"=>"9", "expenditure"=>"", "status"=>"1", "_destroy"=>"false", "id"=>"", "time4"=>"0", "time3"=>"0", "time2"=>"0", "time1"=>"0"},
"1333432762803"=>{"partnercomment"=>"1", "expenditure"=>"", "status"=>"1", "_destroy"=>"false", "id"=>"", "time4"=>"0", "time3"=>"0", "time2"=>"0", "time1"=>"0"},

I recently upgraded my bundles and suspect javascript timestamp saved in wrong manner after that upgrade.
Please someone take a look at the issues we are having to make the nested_form better.

from nested_form.

lest avatar lest commented on July 30, 2024

Could you please push a test application reproducing this issue? Thanks.

from nested_form.

mantas avatar mantas commented on July 30, 2024

I bumped into this bug recently. It seems to be not related to nested_issue. It's Rails and Ruby compatibility issue. Everything works fine with 1.9.* Rubies, but bug appears with 1.8.7. I guess this bug should either be forwarded to RoR issues or forgotten as legacy bug...

from nested_form.

lest avatar lest commented on July 30, 2024

Closing as this issue seems not being related to nested_form.

from nested_form.

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.