stergosz
stergosz

Reputation: 5860

ruby on rails index action not loading by default

The Controller:

class SearchController < ApplicationController

  def index

  end

end

routes.rb

get "search/index"

from rake routes

search_index GET    /search/index(.:format)        search#index

when i try to go to http://localhost:3000/search i get a 404 page error...

Upvotes: 0

Views: 364

Answers (1)

gabrielhilal
gabrielhilal

Reputation: 10769

Your routes should be:

 search_index GET    /search(.:format)              search#index

change your get "search/index" to:

resources :search, :only => [:index]

Upvotes: 4

Related Questions