嘿,夥計們一些幫助,這是我的路線文件我需要在軌路由
Rails.application.routes.draw do
get 'home/store'
get 'home/chat'
get 'home/index'
root 'home#index'
# For details on the DSL available within this file, see http://guides.rubyonrails.org/routing.html
end
,這是我的控制器
class HomeController < ApplicationController
def index
end
def chat
end
def store
end
end
,我連接我的三個頁面index.html.erb, chat.html.erb,store.html.erb這是在主文件夾中 像這樣application.html.erb
<ul class="nav navbar-nav">
<li><link_to "Home","index.html></li>
<li><link_to "Buy Games","store.html"%></li>
<li><link_to "Watch Videos","#"%></li>
<li><link_to "Ask The Experts","chat.html"%></li>
</ul>
現在的問題是,我的根是哪裏localhost:3000工作正常,但是當我打開任何其他鏈接像通過application.html.erb聊天,然後地址欄是這樣的「localhost:3000/chat.html.erb」但我的文件的位置是在視圖/ home/chat.html.erb同樣的事情發生時,我打開任何其他鏈接
所以我應該怎麼做,使路由工作還試圖把家\ chat.html在鏈接標籤在apllication.html.erb它的作品,但當我回去它添加另一個\家在地址欄中
也我的背景圖像,我把內聯風格顯示,但是當我打開任何其他網頁,如聊天。 html.erb然後內聯css背景圖像不上傳
請參閱的link_to例如:http://api.rubyonrails.org/classes/ActionView /Helpers/UrlHelper.html#method-i-link_to –
你必須添加資源路徑,像這樣'link_to「home」,root_path' –