Closed gregwebs closed 13 years ago
Not sure I got an idea. You want to treat input name "obj1[field1][subfield1]" as { "obj1" : { "field1" : { "subfield1" : "subfieldvalue" } } } ?
yes, exactly. Not me though, Ruby on Rails :). array[] with nothing inside is still interpreted as an array. There is no '.' delimeter
On Sun, Jul 3, 2011 at 2:52 AM, maxatwork < reply@reply.github.com>wrote:
Not sure I got an idea. You want to treat input name "obj1[field1][subfield1]" as { "obj1" : { "field1" : { "subfield1" : "subfieldvalue" } } } ?
Reply to this email directly or view it on GitHub: https://github.com/maxatwork/form2js/pull/2#issuecomment-1491777
Check out latest 'develop' branch. There is no rails option, but it should correctly recognize ruby object.
looks great! '.' is not valid in a field name in Rails, so there really isn't overlap between the two styles. If you could update your docs to [a-zA-Z_] or otherwise indicate case insensitivity, that would be great!. Although I think it would be more simple in the docs and clear in the code to do the opposite match on [0-9]+. I will start using this code- let me know if you make more updates and want me to try out latest. Thanks!
Without it a rails object will get turned into an array Not yet extensively tested- it is working on one form I tried it on, but have not tested on nested objects Code could probably be made more DRY