Attachment_fu问题
我正在尝试在 jRuby-1.5.2 和 Rails 3 上使用attachment_fu + 图像科学。我已遵循attachment_fu 文档。但是,当我从浏览器上传表单时,我在 validate_as_attachment 上收到错误消息,指出大小不能为空。这就是日志所说的
大小不能为空翻译缺失:en.activerecord.errors.messages.inclusion
当我修改插件以忘记大小检查或不添加 validate_as_attachment 检查时,会在数据库表中创建一个条目,但实际情况文件未传输。
任何人都可以指导我吗?还有可用的 Rails3 兼容插件吗?
感谢您的帮助
I am trying to use attachment_fu + image science on jRuby-1.5.2 and Rails 3. I have followed the attachment_fu docs. However, when I upload the form form the browser, i get an error on validate_as_attachment saying size cannot be blank. This is what the log says
size can't be blank translation missing: en.activerecord.errors.messages.inclusion
when I modify the plugin to forget size check or not add validate_as_attachment check, an entry is made in the DB table but the actual file is not transfered.
Can anyone please guide me, Also is there a Rails3 compatible plugin available.
Thanks for the help
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
AttachmentFu 相当旧。我不知道它是否还在积极维护。
想到的替代方案是 Paperclip 和 Carrierwave。回形针是较旧的,很好,但感觉有点过时。 Carrierwave 感觉与 Rails 3 更加同步,而且我听到了很多关于它的精彩内容。
AttachmentFu is rather old. I don't know if it's still being maintained actively.
The alternatives that pop into mind are Paperclip and Carrierwave. Paperclip is the older one, good, but feels a bit dated. Carrierwave feels more in sync with Rails 3 and I've been hearing a lot of great things about it.
您需要在您的 config/locales/en.yml 文件中添加类似的内容
You need to add to your
config/locales/en.yml
file something like我建议你将 Attachment_fu 更改为 gem,
如果您还没有这样做,请将其添加到您的 Gemfile 中:
因为我在此处提供的链接包含使其在 Rails 3 和 4 上工作的补丁。
当您遇到兼容性问题时,通常会出现此错误。
更新你的 Attachment_fu 后,请确保每当你实例化一个新图像时,你都会执行如下操作:
如果你检查实现,签名已更改,这就是为什么你应该将图像模型的初始化更改为这样
I suggest you change your attachment_fu to be a gem,
if you haven't done it yet, add this on your Gemfile:
Because this version I'm providing the link here has the patch for making it work on rails 3 and 4.
This error you are getting happens normally when you have compatibility issues.
After updating your attachment_fu then make sure that, whenever you instantiate a new image you do something like this:
If you check on the implementation, the signature has changed, that's why you should change the initializations of your image models to be like this