按照https://github.com/jordan-brough/heroku-pdf上的指南,我设法让wicked_pdf在本地工作并按预期创建PDF.然而,一旦我推送到heroku,应用程序崩溃一段时间我每次调用pdf
日志给了我这个:
2011-05-19T06:36:56+00:00 app[web.1]: Started GET "/authors/cash_payment_receipt/4dd4aff0a2d5a5000100000c.pdf" for XXX.XXX.XXX.XXX at Wed May 18 23:36:56 -0700 2011
2011-05-19T06:36:56+00:00 heroku[router]: Error H13 (Connection closed without response) -> GET xxx.xxxx.com/authors/cash_payment_receipt/4dd4aff0a2d5a5000100000c.pdf dyno=web.1 queue=0 wait=0ms service=0ms bytes=0
2011-05-19T06:36:56+00:00 app[web.1]: !! Unexpected error while processing request: PDF could not be generated!
2011-05-19T06:36:56+00:00 app[web.1]: /app/.bundle/gems/ruby/1.8/gems/wkhtmltopdf-0.1.2/bin/wkhtmltopdf_linux_386: error while loading shared libraries: libfontconfig.so.1: cannot open shared object file: No such file or directory
Run Code Online (Sandbox Code Playgroud)
我将wkhtmltopdf bin添加到我的rails-root/bin目录,检查权限,一切正常.我首先尝试了0.10rc2并向下移动到0.9.9,但它都给出了相同的结果.
我在谷歌上找不到与我的错误相关的任何内容.我不明白我做错了什么.
环境是: - rails 3.0.7 - ruby 1.8.7
谢谢,
麦酒
到目前为止,我一直试图使用设计允许2个不同的注册路径到同一个用户模型.
我的用户模型链接到其他数据模型,但在注册时我并不关心.但我仍然希望"显示"用户的差异(网址路径,外观和感觉等)加上当然我想在用户模型中保存我的用户所用的用户类型,以便稍后再回来指出并询问我需要填写我的其他模型(链接到用户).
我已经探索了改写我自己的注册控制器的道路,但是我不知道这对路线有什么帮助...我想要像:/ usertype1/signup和/ usertype2/signup虚拟更多比2个usertypes,但最后它应该只创建最简单的用户模式(电子邮件,密码,确认,usertype).
在这一点上欢迎任何建议:)
亚历克斯
我已经使用Mongoid大约3个月了,由于那里有很棒的文档和资源,我已经设法完成了我需要的任何事情.
但是回过头来改进一些我已经退缩的东西,我肯定在嵌入式文档上苦苦挣扎.
简而言之,我要做的是在嵌入式文档上维护版本控制和时间戳,但我无法做到.
这是我模型的相关部分:
class Content
include Mongoid::Document
include Mongoid::Timestamps
include Mongoid::Paranoia
embeds_many :localized_contents
accepts_nested_attributes_for :localized_contents
end
class LocalizedContent
include Mongoid::Document
include Mongoid::Timestamps
include Mongoid::Paranoia
include Mongoid::Versioning
embedded_in :content, :inverse_of => :localized_contents
end
Run Code Online (Sandbox Code Playgroud)
这里没有什么真正复杂的,关于内容模型的行为一切正常,但是LocalizedContent模型的表现并不像我期望的那样,所以我的期望要么需要理顺,要么我需要帮助解决我做错的事情.
要创建新的嵌入式文档,请执行以下操作:
my_content = Content.find(params[:id])
my_content.localized_contents.build(params[:localized_content])
if parent.save
#redirect, etc.
end
Run Code Online (Sandbox Code Playgroud)
这是因为它在正确的内容中成功创建了一个新的嵌入式文档,但是我留下的时间戳字段为零
现在,如果我尝试更新那个localized_content:
my_content = Content.find(params[:content_id])
localized_content = my_content.localized_contents.find(params[:id])
Run Code Online (Sandbox Code Playgroud)
现在,如果我这样做:localized_content.update_attributes(params[:localized_content])我收到以下错误:
=> Mongoid::Errors::InvalidCollection: Access to the collection for LocalizedContent is not allowed since it is an embedded document, please access a collection from the …Run Code Online (Sandbox Code Playgroud) 我一直在我的应用程序中使用默认的内置闪存,但现在我意识到我需要更多的功能: - 我需要消息自动隐藏avec给定的秒数(可以为每条消息指定)伟大的) - 我需要一个小关闭按钮,所以客户可以随时摆脱它 - 我需要能够在那里添加一个简单的href链接,用户可以点击它,如果他想
这样做的任何好方法都不会让我满足于我的代码?
cancan ×1
devise ×1
flash ×1
heroku ×1
hyperlink ×1
message ×1
mongodb ×1
mongoid ×1
registration ×1
wkhtmltopdf ×1