2017-10-12 68 views
0

我有一個巨石。
Monolith由兩個應用程序app1app2組成。
該文件保存在app1中,但在app2中顯示(@ticket.document.url)至於回形針更改保存路徑?

@ticket.document.url(在app2)將顯示路徑app2_root/public/system/path/to/file,但該文件是在app1_root/public/system/path/to/file

如何改變保存路徑默認設置?

回答

1

我會實現一個API,如果你需要從另一個應用程序編程計算的數據。

我可能會繼續前進,做這樣的事情在應用1:

class TicketsController < ApplicationController 
    def show 
    respond_to do |format| 
     format.json { render json: {ticket: {document_url: @ticket.documment.url}} } 
     format.html 
    end 
    end 
end 

然後在應用2:

json_string = open("https://www.app1.com/tickets/1.json") { |io| io.read } 
json = JSON.parse(json_string) 
document_url = json.fetch("ticket").fetch("document_url") 
+0

我發的文件夾'公共/ system'總(符號鏈接)和有效。 – dmitriy