Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

No Route Matches [GET] "demo/hello"

Currently running through a ruby on rails guide and I seem to have hit a slight snag. I duplicated a view in one of my view folders:

hello.html.erb and index.html.erb

When trying to access it via browser (localhost:3000/demo/"...") Only the original demo/index works but demo/hello has "No Route Matches"

like image 998
Geno Diaz Avatar asked Sep 06 '13 22:09

Geno Diaz


1 Answers

Add

 get "demo/hello" => "your-controller#your/action"

to your routes.rb

For example:

app/controllers/demos_controller.rb:

class DemosController < ApplicationController

  def hello
  end

end

app/views/demos/hello.html.erb:

<p>Hello World</p>

config/routes.rb:

get "demo/hello" => "demos#hello"

UPDATE: From the comments: check out the rails guide for more details: http://guides.rubyonrails.org/routing.html

like image 154
Matthias Avatar answered Oct 28 '22 08:10

Matthias