title: Rails ActiveResource undefined method `map' for nil:NilClass
body: <p>I have created two applications.</p>
  
  <p>In first application, in PublicItem controller I render json data from Item controller like this:</p>
  
  <pre><code>  def index
      render json: Item.all
    end
  </code></pre>
  
  <p>When I access this controller via web browser, I see jason data
  I want to use ActiveResource to display this data in my other application. In the other application I have created Activeresource model to communicate with application like this:</p>
  
  <pre><code>class Item &lt; ActiveResource::Base
    self.site = "http://localhost:3000/public"
  end
  </code></pre>
  
  <p>In my Form model, I have created item method like this:</p>
  
  <pre><code>  def item
      @item ||= Item.find(item_id) unless item_id.blank?
    end
  </code></pre>
  
  <p>in my view _form I have created collection secelc where I would like to see all the records like this:</p>
  
  <pre><code>&lt;p&gt;
    &lt;%= f.label :item_id %&gt;
    &lt;%= f.collection_select :item_id, Item.find(:all), :id, :name %&gt;
  &lt;/p&gt;
  </code></pre>
  
  <p>I have also created migration for adding item_id to Forms model.</p>
  
  <p>But I am getting error:</p>
  
  <pre><code>undefined method `map' for nil:NilClass
  
  25: 
  26: &lt;p&gt;
  27:   &lt;%= f.label :item_id %&gt;
  28:   &lt;%= f.collection_select :item_id, Item.find(:all), :id, :name %&gt;
  29: &lt;/p&gt;
  30: 
  31: 
  </code></pre>
  
  <p>Can anyone tell me why am I getting this error?</p>