我正在構建組織內部使用的rails應用程序。在新選項卡/窗口上打開LOCAL客戶端路徑 - Rails
所有客戶機驅動器映射到共享文件夾,全部由相同的路徑,它看起來像訪問: file://emc01a/projects/.../HTML_Report/index.html
,我使用了下面這樣的塊嘗試:
<%= link_to "Click here to view the report", @test_meta.test_log, target: "blank" %>
這會生成正確的鏈接,但應用程序根本沒有響應。
接下來,我想:
<%= link_to "Click here to view the report", "http://"[email protected]_meta.test_log, target: "blank" %>
本作的差別,現在一個新的選項卡打開,但因爲它是翻譯的路徑不工作:emc01a/projects/.../HTML_Report/index.html
,無法通過瀏覽器來解決實際路徑。
我也試過:
<%= link_to "Click here to view the report", "http://file:"[email protected]_meta.test_log, target: "blank" %>
這給我帶來了file//emc01a/projects/.../HTML_Report/index.html
如此接近,但我沒能工作還沒有。
有什麼想法嗎? :)
「target」的值應該是「_blank」而不是「空白」 – 2014-08-28 08:53:43
這個@文件路徑將被解釋爲@file的值減去路徑的值是什麼你想要做什麼?如果它是單個變量,則將其重命名爲「@ file_path」(減號不是用於變量/方法名稱的有效字符) – 2014-08-28 08:55:16
這兩個選項都會根據請求創建一個新選項卡,但它不適用於所需的文件路徑。 – cyber101 2014-08-28 08:56:26