title: Rails - Simple Search from Railscast Not Displaying
body: <p>i've been following the railscast tutorial on how to create a simple search form,
  for some odd reason, whenever I search the URL changes and the server log shows that it searches for the post, in this case an ad, but it doesnt display it.</p>
  
  <p>My Ad Controller.</p>
  
  <pre><code>class AdsController &lt; ApplicationController
    before_action :set_ad, only: [:show, :edit, :update, :destroy]
  
  
    # GET /ads
    # GET /ads.json
    def index
      @ads = Ad.search(params[:search])
      @ads_small = Ad.where(:size =&gt; "small").order('created_at DESC')
      @ads_medium = Ad.where(:size =&gt; "medium").order('created_at DESC')
      @ads_featured = Ad.where(:size =&gt; "featured").order('created_at DESC')
  
    end
  
    # GET /ads/1
    # GET /ads/1.json
    def show
    end
  
    # GET /ads/new
    def new
      @ad = Ad.new
    end
  
    # GET /ads/1/edit
    def edit
    end
  
    # POST /ads
    # POST /ads.json
    def create
      @ad = Ad.new(ad_params)
      @ad.user_id = current_user.id
  
      respond_to do |format|
        if @ad.save
          format.html { redirect_to @ad, notice: 'Ad was successfully created.' }
          format.json { render action: 'show', status: :created, location: @ad }
        else
          format.html { render action: 'new' }
          format.json { render json: @ad.errors, status: :unprocessable_entity }
        end
      end
    end
  
    # PATCH/PUT /ads/1
    # PATCH/PUT /ads/1.json
    def update
      respond_to do |format|
        if @ad.update(ad_params)
          format.html { redirect_to @ad, notice: 'Ad was successfully updated.' }
          format.json { head :no_content }
        else
          format.html { render action: 'edit' }
          format.json { render json: @ad.errors, status: :unprocessable_entity }
        end
      end
    end
  
    # DELETE /ads/1
    # DELETE /ads/1.json
    def destroy
        @ad.destroy
        respond_to do |format|
          format.html { redirect_to ads_url }
          format.json { head :no_content }
        end
    end
  
    private
      # Use callbacks to share common setup or constraints between actions.
      def set_ad
        @ad = Ad.find(params[:id])
      end
  
      # Never trust parameters from the scary internet, only allow the white list through.
      def ad_params
        params.require(:ad).permit(:title, :url, :preview, :location, :size, :info, :search)
      end
  end
  </code></pre>
  
  <p>My Ad Model</p>
  
  <pre><code>class Ad &lt; ActiveRecord::Base
  
      attr_accessible :title, :url, :preview, :size, :location, :info
      belongs_to :user
    has_attached_file :preview, :default_url =&gt; "missing.jpg", :styles =&gt; { :medium =&gt; "125x125^", :featured =&gt; "250x250^", :showpg =&gt; "400x400^" }, :convert_options =&gt; {:medium =&gt; "-gravity center -extent 125x125", :featured =&gt; "-gravity center -extent 250x250", :showpg =&gt; "-gravity center -extent 400x400"}
  
    validates :title, length: { maximum: 35 }
    validates :url, length: { maximum: 40 }
  
    def self.search(search)
    if search
      find(:all, :conditions =&gt; ['title LIKE ?', "#{search}"])
    else
      find(:all)
    end
  end
  end
  </code></pre>
  
  <p>My Ad Index View</p>
  
  <pre><code> &lt;%= form_tag ads_path, :method =&gt; :get do %&gt;
    &lt;p class="search_f"&gt;
      &lt;%= text_field_tag :search, params[:search], :class =&gt; "glow_f" %&gt;
      &lt;%= submit_tag "Search", :name =&gt; nil, :class =&gt; "submit" %&gt;
  &lt;% end %&gt;
  
  &lt;% @ads.each do |ad| %&gt;
  &lt;% if ad.size == "featured" %&gt;
    &lt;div class="adspace_grid_f"&gt;
      &lt;div class="pic_sec_f"&gt;
        &lt;%= image_tag ad.preview.url(:featured) %&gt;
      &lt;/div&gt;
      &lt;div class="text_info_f"&gt;
        &lt;span class="bold"&gt;&lt;%= link_to ad.title, ad, :class =&gt; "title" %&gt;&lt;/span&gt;&lt;/br&gt;
        &lt;p&gt;&lt;%= truncate(ad.info, length: 90) %&gt;&lt;/p&gt;
        &lt;span class="bold"&gt;&lt;%= ad.location %&gt;&lt;/span&gt;&lt;/br&gt;
        &lt;span class="bold"&gt;&lt;%= ad.url %&gt;&lt;/span&gt;
  
      &lt;/div&gt;
      &lt;% if can? :destroy, ad %&gt;
        &lt;%= link_to 'Delete', ad, :method =&gt; :delete, :class =&gt; "delete" %&gt; 
      &lt;% end %&gt;
    &lt;/div&gt; 
  &lt;% end %&gt;
  &lt;% if ad.size == "medium" %&gt;
    &lt;div class="adspace_grid"&gt;
      &lt;div class="pic_sec"&gt;
        &lt;%= image_tag ad.preview.url(:medium) %&gt;
      &lt;/div&gt;
      &lt;div class="text_info"&gt;
        &lt;span class="bold"&gt;&lt;%= link_to ad.title, ad, :class =&gt; "title" %&gt;&lt;/span&gt;&lt;/br&gt;
        &lt;p&gt;&lt;%= truncate(ad.info, length: 60) %&gt;&lt;/p&gt;
        &lt;span class="bold"&gt;&lt;%= ad.location %&gt;&lt;/span&gt;&lt;/br&gt;
        &lt;span class="bold"&gt;&lt;%= ad.url %&gt;&lt;/span&gt;
  
      &lt;/div&gt;
      &lt;% if can? :destroy, ad %&gt;
        &lt;%= link_to 'Delete', ad, :method =&gt; :delete, :class =&gt; "delete" %&gt; 
      &lt;% end %&gt;
    &lt;/div&gt; 
  &lt;% end %&gt;
  &lt;% end %&gt;
  </code></pre>
  
  <p>Any help would be greatly appreciated.</p>