我有一個Rails應用程序,並且在我的一個頁面上,由於某種原因,只有在新選項卡中打開鏈接時,這些鏈接纔有效。只有在新選項卡/窗口中打開時鏈接纔有效
我有一個主控制器打開鏈接到其他控制器罰款。當我位於我的位置控制器中時,由於某種原因,鏈接僅在新選項卡中打開。該URL是正確的,唯一的問題是當我只點擊鏈接時什麼也沒有發生。
這裏是我的鏈接:
<a id="menu_link" href="../">Menu</a>
的href
基本上是說回到站點的根目錄。
我也曾嘗試:
<%= link_to({:controller => "main", :action => "home"}, :id => 'menu_link') do %>
<li>Menu</li>
<% end %>
我的routes.rb文件:
root :to => "main#home"
match 'admin', :to => 'access#admin_index'
match 'locations', :to => 'ranch_locations#locations'
match ':controller(/:action(/:id))(.:format)'
聽起來像一個JS問題。你使用什麼腳本? – Dogbert
你嘗試過「link_to」root「root_path」嗎? – ryudice
@Dogbert你的傳奇這就是我所要說的!我愛你! –