Route code not recognized in browser


#1

I wrote out a route code and got it to be acknowledged by the rake route command, but when I go to the browser it gives me the error message of routing error no route matches. What is going on and how do I fix it. Thank you.


#2

Hi @Dempshi

It would be easier for us to help you solve the problem if you could provide some code and also tell us what tools are you using (frameworks, etc.)


#3

I am using rails and this is the code for my route:
get ‘welcome/home’, to: ‘welcome#home’

Again this is recognized when I use rake route but not when I go to the browser and try to implement it.
Thank you


#4

What URL are you entering to access this route? Do you have a welcomes controller? This route definition seems kind of strange.


#5

I am using the url that comes within a new rails starter pack, so to speak. All I am trying to do is add a page to an existing url within that app. I have a controller, and the route comes up when I input the rake routes command, however when I try to execute with the url it will not recognize the route. I am in the midst of a course on ruby and rails and get everything the instructor does until this.


#6

Hello!

I have the same problem here…I working on a Udemy course, and is the same example!!

My controller:

class WelcomeController < ApplicattionController

def home

end

end

My route file:

Rails.application.routes.draw do

get 'welcome/home', to:  'welcome#home'

end

my home.html.erb file (views/welcome/home.html.erb)

Home page!

the URL that I´m using:

https://ruby-on-rails-otavionestares.c9users.io/welcome/home


#7

I had to change the route to;
get ‘welcome/home’ => ‘welcome#home’

I am not sure why but this server does not seem to recognize the to: in the route.


#8

Using welcome/home for the URL is quite strange and it’s probably what’s giving you the error. Try this:

get 'welcome', to: 'welcome#home'


#9

Hey guys! Thanks!!

I don´t know why, but I reset my computer and logged in again on C9 IDE and everything worked without any change on code!