What I've done before is to call
response.template.render :partial => "blah"

This rendered the specified partial.
However this had to be done for either the whole form, thus there is
no point having <survey:questions />, <survey:questions:each />,
<survey:questions:each:question /> which does not work for me or ...

Alternatively, call render only for individual question input fields,
since you would be out of the block for calling form_for.

Example to clarify:

tag "survey:form" do |tag|
  response.template.form_for @survey do |form|
    tag.expand
  end
end

tag "survey:questions:each" do |tag|
    survey = tag.locals.survey
    # !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
    # how to access form block variable from above
    #  to do the following
    # !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
    form.fields_for :questions do |f|
      survey.survey_questions.sort_by{|q| q.order}.each do |question|
        tag.locals.question = question
        result << tag.expand
      end
    end
end


tag "survey:questions:each:question" do |tag|
  # how do you access block var f? to do this:
  f.text_field :answer
end


I hope it makes more sense what I'm trying to accomplish.

Reply via email to