使用如下的Rails.cache.fetch甚至在我的开发环境中缓存(关闭缓存):
@boat_features = Rails.cache.fetch("boat_features", expires_in: 10.minutes) do
BoatFeature.all
end
Run Code Online (Sandbox Code Playgroud)
有没有人遇到过这个?
从本质上讲,我的路线运作完美,乘客似乎正在装载 - 所有都是笨拙的.除了没有Railsy发生.这是从启动服务器到第一个请求的我的Nginx日志(忽略不同的域/路由 - 这是因为我还没有移动新域,并且它返回403错误,因为公共文件夹中没有索引文件):
[ pid=24559 file=ext/nginx/HelperServer.cpp:826 time=2009-11-10 00:49:13.227 ]:
Passenger helper server started on PID 24559
[ pid=24559 file=ext/nginx/HelperServer.cpp:831 time=2009-11-10 00:49:13.227 ]:
Password received.
2009/11/10 00:49:53 [error] 24578#0: *1 directory index of "/var/www/***/current/public/" is forbidden, client: 188.221.195.27, server: ***, request: "GET / HTTP/1.1", host: "***"
2009/11/10 00:49:54 [error] 24578#0: *1 open() "/var/www/***/current/public/favicon.ico" failed (2: No such file or directory), client: 188.221.195.27, server: ***, request: "GET /favicon.ico HTTP/1.1", host: "***", referrer: "***"
Run Code Online (Sandbox Code Playgroud)
RubyOnRails IRC频道上的某人建议它可能是网络服务器权限问题.我怀疑它可能是文件系统权限问题,但随后Nginx以root身份运行为www-data和Passenger.
我可以从公共目录中加载静态文件,但是没有启动Rails应用程序.有没有人有想法?我的头逐渐消失,想出这一个!
编辑:这是vhost文件:
server {
listen …Run Code Online (Sandbox Code Playgroud) 我通过Ajax引入了所有图像,我正在寻找这个项目前端的快速修复.我已经尝试了几个jQuery灯箱插件,但我似乎无法让它们在一个实时功能中执行(纠正我,如果我错了认为我需要这样做).
目前正在尝试使用Balupton的灯箱插件(由于我是新用户而无法链接),并且在尝试了所有示例无效后,我尝试了这个(也没有用):
$('a.lightbox-gallery').live('click', function(){
$(this).lightbox();
});
Run Code Online (Sandbox Code Playgroud)
任何帮助深表感谢!
如果我有邮件对象,例如:
mail = Mail.new do
from "jim@gmail.com"
to "jane@yahoo.com"
subject "Example"
text_part do
body "Blarg"
end
add_file "/some/file/or/some_such.jpg"
end
Run Code Online (Sandbox Code Playgroud)
如果我在我的申请中收到上述邮件
received_mail = mail.encoded
Message.parse(received_mail)
Run Code Online (Sandbox Code Playgroud)
我如何将附件传递给CarrierWave/Paperclip(没有讨论哪个,我会使用哪一个处理这个最好)?我尝试了几种不同的方法,但是我一直在遇到各种绊脚石 - 有没有人有一个可行的解决方案呢?
我目前的尝试是:
mail.attachments.each do |attachment|
self.attachments << Attachment.new(:file => Tempfile.new(attachment.filename) {|f| f.write(attachment.decoded)})
end
Run Code Online (Sandbox Code Playgroud)
这似乎不起作用 - 任何提示?结束
我在使用XSL模板时遇到了一些奇怪的情况.它的大部分输出都很好,但是每个循环都会导致我出现问题.
这是XML:
<area>
<feature type="Hall">
<Heading><![CDATA[Hall]]></Heading>
<Para><![CDATA[Communal gardens, pathway leading to PVCu double glazed communal front door to]]></Para>
</feature>
<feature type="Entrance Hall">
<Heading><![CDATA[Communal Entrance Hall]]></Heading>
<Para><![CDATA[Plain ceiling, centre light fitting, fire door through to inner hallway, wood and glazed panelled front door to]]></Para>
</feature>
<feature type="Inner Hall">
<Heading><![CDATA[Inner Hall]]></Heading>
<Para><![CDATA[Plain ceiling with pendant light fitting and covings, security telephone, airing cupboard housing gas boiler serving domestic hot water and central heating, telephone point, storage cupboard housing gas and electric meters, …Run Code Online (Sandbox Code Playgroud)