gpt4 book ai didi

ruby-on-rails - 回形针更新后突然抛出一个奇怪的错误

转载 作者:行者123 更新时间:2023-12-04 05:49:47 27 4
gpt4 key购买 nike

我无法再在我的 Rails 应用程序中呈现带有回形针 url 的页面。我最近更新了我的 gem 包。我正在使用 Rails 3.2.8 和 Paperclip 3.1.4。我之前使用的是 Paperclip 2.7.0。

我认为失败的链接是:

ad.image.url(:medium)

我的广告模型有以下声明:
Paperclip.interpolates :ad_subdomain do |attachment, style|
attachment.instance.brand.subdomain
end

has_attached_file :image,
:default_url => '/images/blank.gif',
:styles => { :medium => ["290x230>","jpg"],
:thumb => ["100x100>","jpg"] },
:storage => :file,
:path => "/mcp/ads/:style/:ad_subdomain/:basename.:extension"

被抛出的错误是:
TypeError: wrong argument type Class (expected Module)
from /Users/me/.rvm/gems/ruby-1.9.3-p0@mcp5/gems/paperclip-3.1.4/lib/paperclip/attachment.rb:368:in `extend'
from /Users/me/.rvm/gems/ruby-1.9.3-p0@mcp5/gems/paperclip-3.1.4/lib/paperclip/attachment.rb:368:in `initialize_storage'
from /Users/me/.rvm/gems/ruby-1.9.3-p0@mcp5/gems/paperclip-3.1.4/lib/paperclip/attachment.rb:80:in `initialize'
from /Users/me/.rvm/gems/ruby-1.9.3-p0@mcp5/gems/paperclip-3.1.4/lib/paperclip/instance_methods.rb:5:in `new'
from /Users/me/.rvm/gems/ruby-1.9.3-p0@mcp5/gems/paperclip-3.1.4/lib/paperclip/instance_methods.rb:5:in `attachment_for'
from /Users/me/.rvm/gems/ruby-1.9.3-p0@mcp5/gems/paperclip-3.1.4/lib/paperclip.rb:191:in `block in has_attached_file'

最佳答案

出于某种原因,我有:

:storage => :file

在我的声明中。那行不通。如果你想使用文件系统,你只需完全省略存储行,它就会默认。

关于ruby-on-rails - 回形针更新后突然抛出一个奇怪的错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/12059939/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com