title: Passing a form object to a partial rendered from an ajax request
body: <p>I have an event form with some nested attribute models. The additional models are rendered after a client is selected from a select box. An observer watches and calls a controller action which renders a partial containing the fields_for nested models. The issue I'm having is that I can't pass the event 'form' block to the newly rendered partial - at least I can't figure out how...</p>
  
  <p>The code below raises the error: "wrong number of arguments (0 for 1)". Any help or suggestions are appreciated. As mentioned below, I'm also willing to re-implement this using unobtrusive JavaScript if you can provide an example for this scenario.</p>
  
  <p>Event Form:</p>
  
  <pre><code>&lt;%- form_for @event do |form| %&gt;
  
    &lt;%= select_tag :id=&gt;event_client_id %&gt;
    &lt;%= observe_field :event_client_id, url =&gt; {:action =&gt; 'client_questions'}, :with =&gt; "'client_id=' + encodeURIComponent(value)+'&amp;event_id='+#{@event.id} %&gt;
  </code></pre>
  
  <p>Event Controller</p>
  
  <pre><code> def client_questions
     @event = Event.find(params[:event_id])
     @client = Client.find(params[:client_id])
     @client_questions = @client.questions.active
     respond_to do |format|
       format.js {
         render :update do |page|
           page[:client_questions].replace_html :partial =&gt; 'client_questions', :layout =&gt; false
         end
       }
     end
   end
  </code></pre>
  
  <p>_client_questions.html.erb partial</p>
  
  <pre><code>&lt;%- form.fields_for :client, @client do |client| %&gt;
    &lt;%= client_text_field :name %&gt;
  
    &lt;%- client.fields_for :questions do |question| %&gt;
      &lt;%=question.text_field :content %&gt;
  </code></pre>