Skip to content

Child index vs. inputs block #33

julian7 opened this Issue Aug 11, 2009 · 5 comments

2 participants

julian7 commented Aug 11, 2009

In the doc, the only way to interpolate through has_many with child index numbering is to use <generator>.inputs :for => <scope>. However, it doesn't accept blocks, eg. only the most basic solution is supported.

I'd like to give block to .inputs to hand-craft the form, but I'd like to use child index numbering as well. For the first half, I have to use <generator>.semantic_fields_for, but it doesn't set params[:parent] implicitly. However, this setting is a requirement for calling parent_child_index (obviously).

Maybe params[:parent] could be transferred in formbuilder's options somehow to the child scope.


.inputs :for => with block should work. Only to notes:

1) Remember to not use the equal sign (=) in your ERB (<%=) since you are giving a problem;
2) Some people already related issues with haml.

Which one are you using?

julian7 commented Aug 12, 2009

Well yes, I'm using haml. Sadly my devel environment (which is in a colinux host) is not accessible when I'm using Cisco VPN, but I'll be able to check it tomorrow.

Hmm I see, .inputs :for => gives a new scope in proc parameter. Is it documented?


Yes, it's documented. If you don't give the new proc scope, an error should be raised.

julian7 commented Aug 18, 2009

OK, I tested it, and it was an user error. I haven't noticed any issues with haml, by the way.

After a few hours of play it turned out this is not good for my problem (eg. numbering of sub-forms in a has_many environment).


Thanks for replying! I will close this one, feel free to re-open or open another ticket if you find another issue.

This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.