的情況下輸出sinatra中的變量在存在用於erb remplates的<%%塊內部存在用於輸出變量的「concat」之類的幫助器。我可以在Sinatra中使用哪個幫手執行相同的操作,而不使用<%=%>塊?我的意思是,像 <%
#code
concat "This should be rendered in HTML, not in console"
#code
%>
編輯 視圖中的代
我正在做一個簡單的查詢到數據庫表發送到外部服務,但我需要添加一個元素到每個返回的記錄之前,我這樣做。 app.rb get "/:task/:account_id/contacts" do
@contacts = Contact.where("Account = ?", params[:account_id])
@contacts.to_json
end
提供我,我需要