我有一个基于Ruby和Sinatra的工作应用程序部署在Heroku上.
我想利用Heroku上可用的HTTP缓存,它使用Varnish.
我不确定设置标头的最佳方法是什么,以及正确的语法.
有关最佳方法和语法的任何想法?
before do
headers "Content-Type" => "text/html; charset=utf8"
end
get '/' do
headers['Cache-Control'] = 'public, max-age=600'
# SOME STUFF HERE
haml :home, {:layout => :layout_minfooter}
end
Run Code Online (Sandbox Code Playgroud) 我有一个模型,称为交付:
property :id, Serial
property :created_at, DateTime
property :updated_at, DateTime
property :price, BigDecimal, :precision => 10, :scale => 2
Run Code Online (Sandbox Code Playgroud)
交付有一个价格,在SQLite中查看的价格是5.49,6.95,4.95等
在输出中显示此信息(以haml编码)时,来自delivery.price的值显示为0.695E1,0.495E1等
知道为什么他们以这种格式显示,以及如何最好地正确显示它们.
所有帮助表示赞赏!