title: ruby like query error
body: <p>This is my code for mysql like query:</p>
  
  <pre><code>def search
      params.permit!
      @query = params[:query]
      respond_to do |format|
          @outlet = Outlet.select(:name).where("name like ?","%#{@query}%")
          format.json { render json: @outlet }
      end
  end
  </code></pre>
  
  <p>It renders all of my data from table. It does not respond to the query. Do you have any ideas?</p>
  
  <p>My route is:</p>
  
  <pre><code> namespace :api do
    resources :outlets, :defaults =&gt; { :format =&gt; 'json'}
    get 'outlets/auto_complete' =&gt; 'outlets#auto_complete', :defaults =&gt;       { :format =&gt; 'json'}
    post 'outlets/search' =&gt; 'outlets#search', :defaults =&gt; { :format =&gt; 'json' }
  
   end
  </code></pre>
  
  <p>The development.log is</p>
  
  <pre><code>    Started POST "/api/outlets/search" for 127.0.0.1 at 2015-05-30 16:56:22 +0530
  Processing by Api::OutletsController#search as JSON
    Parameters: {"outlet"=&gt;{"query"=&gt;"life"}}
    [1m[35mOutlet Load (0.1ms)[0m  SELECT `outlets`.`name` FROM `outlets`  WHERE (name like '%%')
  Completed 200 OK in 28ms (Views: 22.3ms | ActiveRecord: 1.7ms)
  </code></pre>