Rails API的新手。我想在我的視圖中顯示更新的圖片。我從拉JSON數據可以發現hereRails JSON API:更新圖片在視圖中不顯示
我的模型
def self.get_api_info
helio_api = "http://www.lmsal.com/hek/her?cosec=2&cmd=search&type=column&event_type=fl,bu&event_starttime=2017-03-01T00:00:00&event_endtime=2017-03-08T00:00:00&event_coordsys=helioprojective&x1=-1200&x2=1200&y1=-1200&y2=1200"
request_to_helio_api = Net::HTTP.get(URI(helio_api))
JSON.parse request_to_helio_api
end
我的控制器
def index
@helio_info = HelioApi.get_api_info
end
而且我查看
<img src="<%= @helio_info["gs_thumburl"] %>" />
嘗試'「/>' – Pavan
我認爲錯誤是在我的模式l我如何處理API。但是,當我嘗試這個時,我得到了'沒有將字符串隱式轉換爲整數' –