开发者

Ruby-newbie routing error

I am writing my first routing rule in rails and I am getting some errors.

No route matches "/index.htm开发者_StackOverflow中文版l"

In my routes.rb file I do have this:

Blog::Application.routes.draw do
  get "home#index"

and further below it I have this:

root :to => "home#index"

and also I have been getting errors about not having the controller set up. But I was going through this tutorial http://guides.rubyonrails.org/getting_started.html and there were no explicit steps to set them up.

Is my mapping incorrect? How can I fix this? :) Thanks!

Also, here is a url where you can see the fuller error :) http://128.28.204.195:3000/


It should be

Blog::Application.routes.draw do
  get "home/index"


Blog::Application.routes.draw do

  ... other routes ...

  root :to => "home#index"
end

You don't need get "home#index". After you can use root_path() or root_url() helpers for link to your home page.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜