title: Getting ArgumentError wrong number of arguments (0 for 1)
body: <p>When I run my application I am getting the following error: </p>
  
  <pre><code>ArgumentError in StatesController#filter
  
  wrong number of arguments (0 for 1)
  </code></pre>
  
  <p>My controller looks like this: </p>
  
  <pre><code>class StatesController &lt; ApplicationController
      def filter(my_string)
  
          @new_array = []
          @new_array = state.each {|x| if /#my_string/i =~ x then puts x end}
          return @new_array
  
      end
  
  end
  </code></pre>
  
  <p>And my view looks like this:</p>
  
  <pre><code> &lt;?xml version="1.0" encoding="utf-8"?&gt;
  &lt;!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
      "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"&gt;
  &lt;html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"&gt;
    &lt;head&gt;
      &lt;title&gt;States&lt;/title&gt;
    &lt;/head&gt;
  
    &lt;body&gt;
  
          &lt;% States.filter(params[:substring]) %&gt;
          &lt;p&gt;&lt;%= @new_array.each %&gt;&lt;/p&gt;
          &lt;% if @new_array.size = 0 %&gt;
          &lt;p&gt;No matches!&lt;/p&gt;
  
      &lt;/body&gt;
  
  &lt;/html&gt;
  </code></pre>
  
  <p>What wrong with my code?</p>
  
  <p>thanks so much</p>