Dave
Dave

Reputation: 2018

Trying to set up route paths, getting no route match

I am having big issue setting up my views.. whenever I go on my page localhost/clear I get No route matches [GET] "/clear".

I have a folder named clear in my controllers with the controller files in it.

How do I set up this to be like:

localhost/clear as main view, 
and other one as
localhost/clear/connect
localhost/clear/test

base_controller.rb

class Clear::BaseController < ApplicationController  
    def index  
    end  
    end  

connect_controller.rb

class Clear::ConnectController< Clear::BaseController

    def index 
       @functions
end
end

routes.rb

   resources :clear, only: :index
   namespace :clear do
    resources :connect, only: :index
    resources :test, only: :index
end

Upvotes: 1

Views: 38

Answers (1)

razvans
razvans

Reputation: 3251

You are missing the route for /clear

# routes.rb

namespace :clear do
  resources :base, only: :index, path: '/'
  resources :connect, only: :index
  resources :test, only: :index
end

This is how to check which routes you have

rake routes | grep clear
# =>
clear_base_index GET    /clear(.:format)           clear/base#index
clear_connect_index GET /clear/connect(.:format)   clear/connect#index                                                                                   
clear_test_index GET    /clear/test(.:format)      clear/test#ind

Upvotes: 1

Related Questions