title: NoMethodError : undefined method `each' for nil:NilClass
body: <p>I'm trying to follow the tutorial Searching and Buying Twilio Phone Numbers here -->http://www.twilio.com/docs/howto/search-and-buy</p>
  
  <p>For now, All I want to do is to list the available phone numbers. Right now I have a find_numbers controller, with new, create, destroy. </p>
  
  <p>The New Action has paramaters which the user fills out, and the create action renders the show, and the show is supposed to put it all together, and list the numbers. </p>
  
  <p>However, with the code that I have, I get the error </p>
  
  <pre><code>NoMethodError in Find_numbers#create
  
  Showing C:/Sites/dct/app/views/find_numbers/show.html.erb where line #1 raised:
  
  undefined method `each' for nil:NilClass
  </code></pre>
  
  <p>I think it's because my @numbers variable is returning nil, because the search parameters aren't set correctly. </p>
  
  <p>Here's my view for the new action : </p>
  
  <pre><code>&lt;div class="container"&gt;
   &lt;div class="row"&gt;
    &lt;div class="span6 offset3"&gt;
      &lt;%= form_tag("/find_numbers", :method =&gt; "post" ) do %&gt;
  
        &lt;%= label_tag(:in_postal_code, "Near US postal code (e.g. 94117):") %&gt;
        &lt;%= text_field_tag(:in_postal_code) %&gt;
  
        &lt;%= label_tag(:near_number, "Near this other number (e.g. +4156562345)") %&gt;
        &lt;%= text_field_tag(:near_number) %&gt;
  
        &lt;%= label_tag(:contains, "Matching this pattern (e.g. 415***EPIC):") %&gt;
        &lt;%= text_field_tag(:contains) %&gt;  
  
        &lt;%= submit_tag("Search", :class =&gt; "btn btn-large btn-primary") %&gt;
  
  
      &lt;% end %&gt;
    &lt;/div&gt;
   &lt;/div&gt;
  &lt;/div&gt;
  </code></pre>
  
  <p>This is the find_numbers controller </p>
  
  <pre><code>class FindNumbersController &lt; ApplicationController
  
      def new
          @user = current_user
      end
  
      def create
          @user = current_user
          render 'find_numbers/show'
      end
  
      def show
          @user = current_user
          client = Twilio::REST::Client.new(@user.twilio_account_sid, @user.twilio_auth_token)
  
          search_params = {}
            %w[in_postal_code near_number contains].each do |p|
              search_params[p] = params[p] unless params[p].nil? || params[p].empty?
          end
  
          local_numbers = client.account.available_phone_numbers.get('US').local
          @numbers = local_numbers.list(search_params)    
  
  
      end
  
  end
  </code></pre>
  
  <p>And this, is the show view </p>
  
    
  
  <pre><code>&lt;%= number.friendly_name %&gt;
  &lt;%= number.phone_number %&gt;
  </code></pre>
  
    
  
  <p>I'm getting closer to the answer since this morning(China time), but still running around in circles! Any help greatly appreciated.</p>