What I would like to be able to do is pass the variable f to the block just like we can do with the yield keyword:
def foo(bar, &block)
yield bar
end
Which would let me do:
<%= render partial: 'form' do |f| %>
<div class="field">
<%= f.number_input :woozyness %>
</div>
<% end %>
Does this make sense as a feature request? Am I missing some obvious reason why this wouldn’t work? How would it best be implemented - as a locals: option or as splat arguments following the name of the yield?
I have done this plenty of times, using a JavaScript function to add the additional item. I used to try to do what I think you’re describing here, and I found I could pass in the f variable in the locals collection. That works fine, even if it is a little tortured-looking.
Now that I have made my client swear off of using IE, I can use the template tag instead, this works all in one layer, and I don’t need to worry about rendering a partial in an Ajax callback.