title: Routing to show action instead of custom action
body: <p>news_controller.rb</p>
  
  <pre><code> class NewsController &lt; ApplicationController
      before_action :set_news, only: [:show]
      before_action :authenticate_user!, except: [:show, :index ]
      def index
  
      @news = News.where( state: true ).paginate(:page =&gt; params[:page],  :per_page =&gt; 12).order('id DESC')
  
      end
  
      def new
  
        @news = News.new
  
  
      end
  
       def show
       @news_photos = @news.news_photos
       end
  
  
        def create
          @news = News.new(news_params)
          if @news.save
            if params[:images]
              params[:images].each do |image|
                @news.news_photos.create(image: image)
              end
            end
  
            @news_photos = @news.news_photos
            redirect_to edit_news_path(@news), notice: "Saved..."
          else
            render :new
          end
        end
  
        def destroy
          @news = News.find(params[:id])
          @news.destroy
  
          respond_to do |format|
            format.html { redirect_to news_index_path }
           # format.json { head :no_content }
         end
       end
  
       def search
          @news = News.search(params[:search])
      end
  
  
  
      private
        def set_news
          @news = News.find(params[:id])
        end 
  
      def news_params
          params.require(:news).permit( :title, :description, :category, :keywords, :user_id, :email, :user_name)
      end
      end
  </code></pre>
  
  <p>news.rb</p>
  
  <pre><code>     class News &lt; ApplicationRecord
       extend FriendlyId
         friendly_id :slug_candidates, use: [:slugged, :finders, :history]
  
           def slug_candidates 
           [ :title,
           [:title, :id]
            ] 
           end
          def self.search(search)
          pg_search_scope :search_full_text, 
                  :against =&gt; :full_text, 
                  :using =&gt; { :tsearch =&gt; { :prefix =&gt; true  }  }
                  end 
               end
  </code></pre>
  
  <p>index.html.erb             </p>
  
  <pre><code>        &lt;div class="fh5co-box"&gt;
              &lt;h3 class="heading"&gt;Search&lt;/h3&gt;
              &lt;%= form_tag(look_path, :method =&gt; "get") do %&gt;
             &lt;%= text_field_tag :search, params[:search], placeholder: "Search news" %&gt;
              &lt;%= submit_tag "Search" %&gt;
               &lt;% end %&gt;
          &lt;/div&gt;
      &lt;/div&gt;
  &lt;/div&gt;
  </code></pre>
  
  <p>routes.rb</p>
  
  <pre><code>      resources :news, :except =&gt; [ :search]
        get 'news/search'  =&gt; 'news#search', :as =&gt; 'look'
  </code></pre>
  
  <p>As I submit the data inside the search field, it is routing to the show action instead of search action.</p>
  
  <p>the routes are</p>
  
  <pre><code> ews_index GET      /news(.:format)                              news#index
                                    POST     /news(.:format)                              news#create
                           new_news GET      /news/new(.:format)                          news#new
                          edit_news GET      /news/:id/edit(.:format)                     news#edit
                               news GET      /news/:id(.:format)                          news#show
                                    PATCH    /news/:id(.:format)                          news#update
                                    PUT      /news/:id(.:format)                          news#update
                                    DELETE   /news/:id(.:format)                          news#destroy
                               look GET      /news/search(.:format)                       news#search
  </code></pre>
  
  <p>log:</p>
  
  <pre><code>     Started GET "/news/search?utf8=%E2%9C%93&amp;search=tax&amp;commit=Search" for 183.83.117.57 at 2017-04-10 07:36:13 -0500
          Processing by NewsController#show as HTML
            Parameters: {"utf8"=&gt;"▒~\~S", "search"=&gt;"tax", "commit"=&gt;"Search", "id"=&gt;"search"}
            ^[[1m^[[36mNews Load (0.5ms)^[[0m  ^[[1m^[[34mSELECT  "news".* FROM "news" WHERE "news"."slug" = $1 ORDER BY "news"."id" ASC LIMIT $2^[[0m  [["slug", "search"], ["LIMIT", 1]]
            ^[[1m^[[36mNews Load (0.7ms)^[[0m  ^[[1m^[[34mSELECT  "news".* FROM "news" INNER JOIN "friendly_id_slugs" ON "friendly_id_slugs"."sluggable_id" = "news"."id" AND "friendly_id_slugs"."sluggable_type" = $1 WHERE ("friendly_id_slugs"."sluggable_type" = 'News' AND "friendly_id_slugs"."slug" = 'search') ORDER BY "friendly_id_slugs"."id" DESC LIMIT $2^[[0m  [["sluggable_type", "News"], ["LIMIT", 1]]
          Completed 404 Not Found in 5ms (ActiveRecord: 1.2ms)
  
  
  
          ActiveRecord::RecordNotFound (can't find record with friendly id: "search"):
  
          app/controllers/news_controller.rb:111:in `set_news'
  </code></pre>
  
  <p>Don't know where I have gone wrong.Is there anything to do with the slugs???</p>
  
  <p>Any Help is highly Appreciated.Thanks in Advance!!!</p>