ActionView::Template::Error (undefined local variable or method...or no error
<p>I wanted to use create action with ajax on 'index' page. I found some similiar problems here on SO, tried to use it, but no help for me so far. HTML works fine, only JS is a problem.</p>

<h1>walls_controller:</h1>

<pre><code>def items
  @item = Item.new
  @items = current_user.items
  find_items
  @ads = @items_ads
end

def create
  @items = current_user.items
  find_items
  #@items_ads via find_items method
  @ads = @items_ads  
  @item = current_user.items.build item_params
  current_user.save
  respond_to do |format|
    format.html { redirect_to :back }
    format.js
  end
end
</code></pre>

<h1>items.html.erb:</h1>

<pre><code>&lt;div id="items1"&gt;
  &lt;div class="row"&gt;
    &lt;div class="col-md-3"&gt;
      &lt;h3&gt;Wall of user &lt;%= current_user.name %&gt;&lt;/h3&gt;
      &lt;div&gt;
        &lt;%= render 'item_form', item: @item %&gt;
      &lt;/div&gt;
      Currently you are looking for these items:
      &lt;div&gt;
        &lt;%= render 'items_list', items: @items %&gt;
      &lt;/div&gt;
    &lt;/div&gt;
    &lt;div&gt;
      &lt;%= render 'ads/ads_list', ads: @ads %&gt;
    &lt;/div&gt;
  &lt;/div&gt;
&lt;/div&gt;
</code></pre>

<h1>_item_form.html.erb:</h1>

<pre><code>&lt;%= form_for(item, url: wall_items_path, remote: true) do |f| %&gt;
...
</code></pre>

<p>First I had error: </p>

<pre><code>ActionView::Template::Error (undefined local variable or method `items' for #&lt;#&lt;Class:...
</code></pre>

<p>then I changed create.js.erb from</p>

<pre><code>$("#items1").html("&lt;%= render 'items_list', locals: {items: @items} %&gt;");
$("#items1").html("&lt;%= render 'ads_list', locals: {ads: @ads} %&gt; ");
</code></pre>

<p>to</p>

<pre><code>$("#items1").html("&lt;%= render 'items_list', items: @items %&gt;");
$("#items1").html("&lt;%= render 'ads/ads_list', ads: @ads %&gt;");
</code></pre>

<p>and now it doesn't show me any error, but no visible change when trying JS on browser. Thanks for help.</p>