Comments (10)
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.
Are you experiencing this problem as well? Or did I do something wrong on my part?
from nested_form.
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.
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.
@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.
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.
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.
Could you please push a test application reproducing this issue? Thanks.
from nested_form.
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.
Closing as this issue seems not being related to nested_form.
from nested_form.
Related Issues (20)
- Can I add different subform (using STI)? HOT 3
- Remove labels
- Cusomized forms
- link_to_add make large index number
- wrong field name for the nested _destroy field
- Incremental counter for nested fields HOT 2
- nested_form shows extra fields after error messages HOT 1
- -
- Limit how many nested_attributes can be added? HOT 1
- undefined method `capture_position=' for nil:NilClass HOT 1
- link_to_remove is not deleted vale only hide that so when we update that send hide value in parmeter HOT 1
- nested_form for recursive Model HOT 1
- on clicking link_to_add nested forms not shown in rails HOT 1
- Sort nested form in edit view based on column HOT 1
- Bootsy wysiwyg editor not supported for nested forms HOT 3
- reject_if if 2 attributes are blank HOT 2
- Callbacks nested
- Link to remove not working as expected when :nested_wrapper is false HOT 1
- When I cleck on <%= f.link_to_add "Add a Step", :steps %>, nothing happens.
- Link_to_add, data: { target: } not working for a bootstrap modal pop up HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from nested_form.